home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / c / xw2.000 / xw2 / xw / csource / x1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-13  |  115.5 KB  |  4,053 lines

  1.  
  2. /*{{{  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
  3.      /*                                                                           */
  4.      /*                                  ---                    -                 */
  5.      /*   Modul X1.C  alias  XbWS alias "XbWindows hardwarenahe Subroutinen"      */
  6.      /*                                  ---                    -                 */
  7.      /*                                                                           */
  8.      /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  9. /*}}}  */
  10. /*{{{  Header--------------------------------------------------------------------*/
  11. #include "xbw.h"
  12. #include <unistd.h>
  13. #include <X11/Xmu/Drawing.h>
  14. #include <string.h>
  15.  
  16. /*}}}  */
  17.  
  18. /*  ---------------------Compiler-Modelle-----------------------------*/
  19.                       /* ---............Nicht moeglich */
  20.                       /* ///............Nicht NOETIG   */
  21.                       /* !!!............Noch zu machen */
  22.                       /* ???............unklar         */
  23.                       /* TC3............Turbo-C Version*/
  24.                       /*     GNU........32-Bit Version */
  25.                       /*         X11....X-Windows      */
  26.  
  27. void XbWFSy_bf_printf(char *a, char *b){
  28.   char sstr[200];
  29.   int ii;
  30.   sprintf(sstr,a,b);
  31.   for (ii=0;ii<strlen(sstr);ii++){
  32.     printf("%c%c%c",sstr[ii],0x08,sstr[ii]);
  33.     };
  34.   };
  35.  
  36.  
  37. /*{{{  XbWSSy_ObjLoadIcon(         X11*/
  38. int  XbWSSy_ObjLoadIcon(void  *(*p)[], int (*t)[]){
  39.   /* Lade eine Datei als Bitmap und setze einen pn-Pointer auf
  40.      den allozierten Speicherbereich */
  41.   XbWDDb_DbINPtr  *TTRG;
  42.   XbWDDb_DbIVar  *TV;
  43.   char objname[50], filename[200], bitmaptype[50];
  44.  
  45.   /* Erwartete Parameter: "Objekt","File", "XY"|"Z" */
  46.   if ( (int)(*p)[0] < 3){ return(1); };
  47.   switch( (int)(*t)[1] ) {
  48.     case XbWDMf_StrPar:
  49.       strcpy(objname,(char*)(XbWFTb_PckTxt((char*)(*p)[1])));
  50.       break;
  51.     case XbWDMf_VLPar:
  52.       {
  53.         XbWDDb_DbIVar  *QQ;
  54.         char *fsp;
  55.         QQ = (XbWDDb_DbIVar  *)(*p)[1];
  56.         if (QQ == NULL) { return(1); };
  57.         fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1);
  58.         if (fsp != NULL) {
  59.           strcpy(objname,(char*)XbWFTb_PckTxt(fsp));
  60.           };
  61.         };
  62.       break;
  63.     };
  64.  
  65.   switch( (int)(*t)[2] ) {
  66.     case XbWDMf_StrPar:
  67.       strcpy(filename,(char*)(XbWFTb_PckTxt((char*)(*p)[2])));
  68.       break;
  69.     case XbWDMf_VLPar:
  70.       {
  71.         XbWDDb_DbIVar  *QQ;
  72.         char *fsp;
  73.         QQ = (XbWDDb_DbIVar  *)(*p)[2];
  74.         if (QQ == NULL) { return(1); };
  75.         fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1);
  76.         if (fsp != NULL) {
  77.           strcpy(filename,(char*)XbWFTb_PckTxt(fsp));
  78.           };
  79.         };
  80.       break;
  81.     };
  82.  
  83.   switch( (int)(*t)[3] ) {
  84.     case XbWDMf_StrPar:
  85.       strcpy(bitmaptype,(char*)(XbWFTb_PckTxt((char*)(*p)[3])));
  86.       break;
  87.     case XbWDMf_VLPar:
  88.       {
  89.         XbWDDb_DbIVar  *QQ;
  90.         char *fsp;
  91.         QQ = (XbWDDb_DbIVar  *)(*p)[3];
  92.         if (QQ == NULL) { return(1); };
  93.         fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1);
  94.         if (fsp != NULL) {
  95.           strcpy(bitmaptype,(char*)XbWFTb_PckTxt(fsp));
  96.           };
  97.         };
  98.       break;
  99.     };
  100.  
  101.  
  102.   if ((TV = XbWFDb_FindGrp("OBJ",objname) ) == NULL) {
  103.     return(1);
  104.     };
  105.   if ((TTRG = (XbWDDb_DbINPtr *)XbWFDb_VarInh(TV,0,"Image",0)) == NULL) {
  106.     return(1);
  107.     };
  108.   if ((TTRG->tp & XbWDDb_Typ) == XbWDDb_NPtr) {
  109.     unsigned char *pmap_data;
  110.     XImage *image;
  111.     int w,h,xh,yh;
  112.     if (XmuReadBitmapDataFromFile(
  113.         filename,
  114.         &w, &h,
  115.         &pmap_data,
  116.         &xh, &yh
  117.         ) == BitmapSuccess){
  118.       switch(bitmaptype[0]){
  119.         case 'x':
  120.         case 'X':
  121.           image = XCreateImage(
  122.             XbWVSy_ConTxt.dpy,
  123.             XDefaultVisualOfScreen(XbWVSy_ConTxt.screen),
  124.             1,
  125.             XYBitmap,
  126.             0,
  127.             pmap_data,
  128.             w,
  129.             h,
  130.             8,
  131.             0);
  132.           break;
  133.         case 'z':
  134.         case 'Z':
  135.           image = XCreateImage(
  136.             XbWVSy_ConTxt.dpy,
  137.             XDefaultVisualOfScreen(XbWVSy_ConTxt.screen),
  138.             8,
  139.             ZPixmap,
  140.             0,
  141.             pmap_data,
  142.             w,
  143.             h,
  144.             8,
  145.             0);
  146.           break;
  147.         default:return(1);
  148.         };
  149.       TTRG->inh = (long)image;
  150.  
  151.       XbWFDb_PutNum(TV,"width",1,w);
  152.       XbWFDb_PutNum(TV,"height",1,h);
  153.       XbWFDb_PutNum(TV,"xhot",1,xh);
  154.       XbWFDb_PutNum(TV,"yhot",1,yh);
  155.       return(0);
  156.       };
  157.     };
  158.   return(1);
  159.   };
  160. /*}}}  */
  161. /*{{{  XbWSSy_ObjDispIcon(         X11    Icon (X11-Bitmap) darstellen*/
  162. void  XbWSSy_ObjDispIcon(XbWDDb_DbIObj  *TO){
  163.   XImage *theimage;
  164.   int x,y,xp,yp;
  165.   char *txtstr;
  166.   XbWDDb_DbINPtr  *TTRG;
  167.  
  168.   txtstr = (char*)XbWFDb_VarInh(TO->chn,XbWDDb_Str,"V",1);
  169.  
  170.   if ((TTRG = (XbWDDb_DbINPtr *)XbWFDb_VarInh(TO->chn,0,"Image",0)) == NULL) {
  171.     return;
  172.     };
  173.   if ((TTRG->tp & XbWDDb_Typ) != XbWDDb_NPtr) {
  174.     return;
  175.     };
  176.   theimage = (XImage *)TTRG->inh;
  177.   x      = XbWFDb_GetNum(TO->chn,"width",1);
  178.   y      = XbWFDb_GetNum(XbWVDb_ActGrp1,"height",1);
  179.  
  180.   if (theimage->width  != x){ return; };
  181.   if (theimage->height != y){ return; };
  182.  
  183.   xp = (XbWVOb_X+XbWVOb_x)/2 - x/2;
  184.   yp = (XbWVOb_Y+XbWVOb_y)/2 - y/2;
  185.  
  186.   XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  187.     XbWVGr_ColorValues[*TO->bfc] );
  188.   XSetBackground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  189.     XbWVGr_ColorValues[*TO->dfc] );
  190.   XPutImage(
  191.     XbWVSy_ConTxt.dpy,
  192.     XbWVSy_ConTxt.window,
  193.     XbWVSy_ConTxt.gc,
  194.     theimage,
  195.     0,0,
  196.     xp+XbWVSy_ConTxt.XA,yp+XbWVSy_ConTxt.YA,
  197.     x,y);
  198.   if (txtstr != NULL){
  199.     XbWSGr_BCBox(XbWVOb_X,XbWVOb_Y,XbWVOb_x-XbWVOb_X,XbWVOb_y-XbWVOb_Y,txtstr,*TO->bkc,*TO->txc,*TO->bkc);
  200.     };
  201.   };
  202. /*}}}  */
  203. /*{{{  XbWSSy_ConvertFileName(     X11    DOS to UNIX Konversion*/
  204. char XbWVSy_ConvertFileNameStr[200]="";
  205. char *XbWSSy_ConvertFileName(char *fname){
  206.   int ii;
  207.   char sstr[200];
  208.   strcpy(sstr,fname);
  209.   if ( (strstr(sstr,"@(dir)") != NULL) ||
  210.       (strstr(sstr,"@(DIR)") != NULL) ){
  211.     char pstr[200];
  212.     char thepath[200];
  213.     getcwd(thepath,199);
  214.     strcpy(pstr,"\\");
  215.     strcat(pstr,thepath);
  216.     strcat(pstr,"\\");
  217.     strcat(pstr,strstr(sstr,"@(dir)")+6);
  218.     strcpy(sstr,pstr);
  219.     };
  220.   if (sstr[0] == '@'){
  221.     char tstr[200];
  222.     sprintf(tstr,"%s%s",XbWVSy_AppPath,(char*)&(sstr[1]));
  223.     strcpy(sstr,tstr);
  224.     };
  225.   for (ii=0;ii<strlen(sstr);ii++){
  226.     if (sstr[ii] == '\\'){
  227.       sstr[ii] = '/';
  228.       }
  229.     else {
  230.       if ((sstr[ii] >= 'A') & (sstr[ii] <= 'Z')){
  231.         sstr[ii] = tolower(sstr[ii]);
  232.         };
  233.       };
  234.     };
  235.   if (XbWVMf_prd){
  236.     printf("FILENAME converted: >>>%s<<< to >>>%s<<<\n",fname,sstr);
  237.     };
  238.   strcpy(XbWVSy_ConvertFileNameStr,sstr);
  239.   return(XbWVSy_ConvertFileNameStr);
  240.   };
  241. /*}}}  */
  242. /*{{{  XbWSSy_fopen(       TC3,GNU,X11    allgemeines open*/
  243. FILE  *XbWSSy_fopen(char *name, char *type){
  244.   int ii;
  245.   char sstr[200];
  246.   strcpy(sstr,name);
  247.   if ( (strstr(sstr,"@(dir)") != NULL) ||
  248.       (strstr(sstr,"@(DIR)") != NULL) ){
  249.     char pstr[200];
  250.     char thepath[200];
  251.     getcwd(thepath,199);
  252.     strcpy(pstr,"\\");
  253.     strcat(pstr,thepath);
  254.     strcat(pstr,"\\");
  255.     strcat(pstr,strstr(sstr,"@(dir)")+6);
  256.     strcpy(sstr,pstr);
  257.     };
  258.   if (sstr[0] == '@'){
  259.     char tstr[200];
  260.     sprintf(tstr,"%s%s",XbWVSy_AppPath,(char*)&(sstr[1]));
  261.     strcpy(sstr,tstr);
  262.     };
  263.   for (ii=0;ii<strlen(sstr);ii++){
  264.     if (sstr[ii] == '\\'){
  265.       sstr[ii] = '/';
  266.       }
  267.     else {
  268.       if ((sstr[ii] >= 'A') & (sstr[ii] <= 'Z')){
  269.         sstr[ii] = tolower(sstr[ii]);
  270.         };
  271.       };
  272.     };
  273.   if (XbWVMf_prd){
  274.     FILE *fp;
  275.     char *sres=">>>FAILED<<<";
  276.     fp = fopen(sstr,type);
  277.     if (fp != NULL){
  278.       sres="      OK";
  279.       };
  280.     printf("%s to open %s (with %s)\n",sres,sstr,type);
  281.     return(fp);
  282.     }
  283.   else {
  284.     return(fopen(sstr,type));
  285.     };
  286.   };
  287.  
  288. /*}}}  */
  289. /*{{{  XbWFTb_Unlink(      ***            Datei loeschen*/
  290. int  XbWFTb_Unlink(void  *(*p)[]){
  291.   char sstr[200];
  292.   int ii;
  293.  
  294.   if ((int)(*p)[0] != 2){ return(1); };
  295.   sprintf(sstr,"%s%s",(char*)(*p)[1],(char*)(*p)[2]);
  296.   if ( (strstr(sstr,"@(dir)") != NULL) ||
  297.       (strstr(sstr,"@(DIR)") != NULL) ){
  298.     char pstr[200];
  299.     char thepath[200];
  300.     getcwd(thepath,199);
  301.     strcpy(pstr,"\\");
  302.     strcat(pstr,thepath);
  303.     strcat(pstr,"\\");
  304.     strcat(pstr,strstr(sstr,"@(dir)")+6);
  305.     strcpy(sstr,pstr);
  306.     };
  307.   if (sstr[0] == '@'){
  308.     char tstr[200];
  309.     sprintf(tstr,"%s%s",XbWVSy_AppPath,(char*)&(sstr[1]));
  310.     strcpy(sstr,tstr);
  311.     };
  312.   for (ii=0;ii<strlen(sstr);ii++){
  313.     if (sstr[ii] == '\\'){
  314.       sstr[ii] = '/';
  315.       }
  316.     else {
  317.       if ((sstr[ii] >= 'A') & (sstr[ii] <= 'Z')){
  318.         sstr[ii] = tolower(sstr[ii]);
  319.         };
  320.       };
  321.     };
  322.   if (XbWVMf_prd){
  323.     printf("\nCAUTION: DELETE >>>%s<<<?\n",sstr);
  324.     puts("Please press 'Y<CR>' to accept; anything else will skip delete");
  325.     if (tolower(getchar())=='y'){
  326.       printf("DELETING >>>%s<<<?\n",sstr);
  327.       getchar();
  328.       }
  329.     else {
  330.       return(0);
  331.       };
  332.     };
  333.   unlink(sstr);
  334.   return(0);
  335.   };
  336. /*}}}  */
  337. /*{{{  XbWSSy_chdirsub(    TC3,GNU,X11    allgemeines chdir*/
  338. int  XbWSSy_chdirsub(char *name){
  339.   int ii;
  340.   char sstr[200];
  341.   strcpy(sstr,name);
  342. #ifdef XbW_SYSDEF_X11_VERSION
  343.   for (ii=0;ii<strlen(sstr);ii++){
  344.     if (sstr[ii] == '\\'){
  345.       sstr[ii] = '/';
  346.       }
  347.     else {
  348.       sstr[ii] = tolower(sstr[ii]);
  349.       };
  350.     };
  351. #endif
  352.   if (strstr(sstr,"@(prj)") != NULL){
  353.     char tstr[200];
  354.     char pstr[200];
  355.     sprintf(pstr,"/xw/x/app/%s@(prj)",XbWVSy_PrjName);
  356.     strcpy(tstr,sstr);
  357.     strcpy(strstr(tstr,"@(prj)"),pstr);
  358.     strcpy(strstr(tstr,"@(prj)"),strstr(sstr,"@(prj)"));
  359.     strcpy(sstr,tstr);
  360.     };
  361.   if (strstr(sstr,"@(dir)") != NULL){
  362.     char tstr[200];
  363.     char pstr[200];
  364.     char thepath[200];
  365.     getcwd(thepath,199);
  366.     sprintf(pstr,"%s@(dir)",thepath);
  367.     strcpy(tstr,sstr);
  368.     strcpy(strstr(tstr,"@(dir)"),pstr);
  369.     strcpy(strstr(tstr,"@(dir)"),strstr(sstr,"@(dir)"));
  370.     strcpy(sstr,tstr);
  371.     };
  372.   if (sstr[0] == '@'){
  373.     char tstr[200];
  374.     sprintf(tstr,"%s%s",XbWVSy_AppPath,(char*)&(sstr[1]));
  375.     strcpy(sstr,tstr);
  376.     };
  377.   return(chdir(sstr));
  378.   };
  379.  
  380. /*}}}  */
  381. /*{{{  XbWFSy_ChDir(               X11    Wechsle Verzeichnis*/
  382. int  XbWFSy_ChDir(void  *(*p)[],int (*t)[]){
  383.   char dirname[60];
  384.  
  385.   strcpy(dirname,"");
  386.   if ((int)(*p)[0] < 1 ) {return(XbWDMf_NoPara);};
  387.   switch( (int)(*t)[1] ) {
  388.     case XbWDMf_StrPar:
  389.       strcpy(dirname,(char*)(XbWFTb_PckTxt((char*)(*p)[1])));
  390.       break;
  391.     case XbWDMf_VLPar:
  392.       {
  393.         XbWDDb_DbIVar  *QQ;
  394.         char *fsp;
  395.         QQ = (XbWDDb_DbIVar  *)(*p)[1];
  396.         if (QQ == NULL) { return(1); };
  397.         fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1);
  398.         if (fsp != NULL) {
  399.           strcpy(dirname,(char*)XbWFTb_PckTxt(fsp));
  400.           };
  401.         };
  402.       break;
  403.     };
  404.  
  405.   XbWSSy_chdirsub(dirname);
  406.   return(0);
  407.   };
  408. /*}}}  */
  409. /*{{{  XbWSMs_SetXXXCursor(t--,GNU,X11    Maustreiber Cursor waehlen*/
  410. /*{{{  XbWSMs_SetStopCursor(   GNU,X11    Maustreiber Handcursor*/
  411. void  *XbWSMs_SetStopCursor(void){
  412. #ifdef XbW_SYSDEF_GNU_VERSION
  413.   extern GrCursor *XbWVMs_PtrPtrStop;
  414.   int cols[3];
  415.   GrCursor *oldcursor;
  416.  
  417.   oldcursor = XbWVMs_PtrActualPtr;
  418.   cols[0] = 2;
  419.   cols[1] = 15;
  420.   cols[2] = 12;
  421.   if(XbWVMs_PtrPtrStop == NULL) {
  422.     XbWVMs_PtrPtrStop = GrBuildCursor(XbWVMs_PtrStop,12,16,1,1,cols);
  423.     };
  424.   if (XbWVMs_PtrActualPtr != XbWVMs_PtrPtrStop){
  425.     MouseSetCursor(XbWVMs_PtrPtrStop);
  426.     };
  427.   XbWVMs_PtrActualPtr = XbWVMs_PtrPtrStop;
  428.   return(oldcursor);
  429. #endif
  430. #ifdef XbW_SYSDEF_X11_VERSION
  431.   extern Cursor XbWVMs_PtrPtrStop;
  432.   Cursor oldcursor;
  433.  
  434.   oldcursor = XbWVMs_PtrActualPtr;
  435.   if(XbWVMs_PtrPtrStop == 0) {
  436.     XbWVMs_PtrPtrStop = XCreateFontCursor(XbWVSy_ConTxt.dpy,XC_pirate);
  437.     };
  438.   if (XbWVMs_PtrActualPtr != XbWVMs_PtrPtrStop){
  439.     XDefineCursor(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,XbWVMs_PtrPtrStop);
  440.     };
  441.   XbWVMs_PtrActualPtr = XbWVMs_PtrPtrStop;
  442.   return((void  *)oldcursor);
  443. #endif
  444.   return(NULL);
  445.   };
  446. /*}}}  */
  447. /*{{{  XbWSMs_SetHandCursor(   GNU,X11    Maustreiber Handcursor*/
  448. void  *XbWSMs_SetHandCursor(void){
  449. #ifdef XbW_SYSDEF_GNU_VERSION
  450.   extern GrCursor *XbWVMs_PtrPtrHand;
  451.   int cols[3];
  452.   GrCursor *oldcursor;
  453.  
  454.   oldcursor = XbWVMs_PtrActualPtr;
  455.   cols[0] = 2;
  456.   cols[1] = 0;
  457.   cols[2] = 15;
  458.   if(XbWVMs_PtrPtrHand == NULL) {
  459.     XbWVMs_PtrPtrHand = GrBuildCursor(XbWVMs_PtrHand,12,16,1,1,cols);
  460.     };
  461.   if (XbWVMs_PtrActualPtr != XbWVMs_PtrPtrHand){
  462.     MouseSetCursor(XbWVMs_PtrPtrHand);
  463.     };
  464.   XbWVMs_PtrActualPtr = XbWVMs_PtrPtrHand;
  465.   return(oldcursor);
  466. #endif
  467. #ifdef XbW_SYSDEF_X11_VERSION
  468.   extern Cursor XbWVMs_PtrPtrHand;
  469.   Cursor oldcursor;
  470.  
  471.   oldcursor = XbWVMs_PtrActualPtr;
  472.   if(XbWVMs_PtrPtrHand == 0) {
  473.     XbWVMs_PtrPtrHand = XCreateFontCursor(XbWVSy_ConTxt.dpy,XC_fleur);
  474.     };
  475.   if (XbWVMs_PtrActualPtr != XbWVMs_PtrPtrHand){
  476.     XDefineCursor(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,XbWVMs_PtrPtrHand);
  477.     };
  478.   XbWVMs_PtrActualPtr = XbWVMs_PtrPtrHand;
  479.   return((void  *)oldcursor);
  480. #endif
  481.   return(NULL);
  482.   };
  483. /*}}}  */
  484. /*{{{  XbWSMs_SetClockCursor(  GNU,X11    Maustreiber Handcursor*/
  485. void  *XbWSMs_SetClockCursor(void){
  486. #ifdef XbW_SYSDEF_GNU_VERSION
  487.   extern GrCursor *XbWVMs_PtrPtrClock;
  488.   int cols[3];
  489.   GrCursor *oldcursor;
  490.   oldcursor = XbWVMs_PtrActualPtr;
  491.  
  492.   cols[0] = 2;
  493.   cols[1] = 0;
  494.   cols[2] = 15;
  495.   if(XbWVMs_PtrPtrClock == NULL) {
  496.     XbWVMs_PtrPtrClock = GrBuildCursor(XbWVMs_PtrClock,12,16,1,1,cols);
  497.     };
  498.   if (XbWVMs_PtrActualPtr != XbWVMs_PtrPtrClock){
  499.     MouseSetCursor(XbWVMs_PtrPtrClock);
  500.     };
  501.   XbWVMs_PtrActualPtr = XbWVMs_PtrPtrClock;
  502.   return(oldcursor);
  503. #endif
  504. #ifdef XbW_SYSDEF_X11_VERSION
  505.   extern Cursor XbWVMs_PtrPtrClock;
  506.   Cursor oldcursor;
  507.   oldcursor = XbWVMs_PtrActualPtr;
  508.   if(XbWVMs_PtrPtrClock == 0) {
  509.     XbWVMs_PtrPtrClock = XCreateFontCursor(XbWVSy_ConTxt.dpy,XC_watch);
  510.     };
  511.   if (XbWVMs_PtrActualPtr != XbWVMs_PtrPtrClock){
  512.     XDefineCursor(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,XbWVMs_PtrPtrClock);
  513.     };
  514.   XbWVMs_PtrActualPtr = XbWVMs_PtrPtrClock;
  515.   return((void  *)oldcursor);
  516. #endif
  517.   return(NULL);
  518.   };
  519. /*}}}  */
  520. /*{{{  XbWSMs_SetArrowCursor(  GNU,X11    Maustreiber Pfeilcursor*/
  521. void  *XbWSMs_SetArrowCursor(void){
  522. #ifdef XbW_SYSDEF_GNU_VERSION
  523.   extern GrCursor *XbWVMs_PtrPtrArrow;
  524.   int cols[3];
  525.   GrCursor *oldcursor;
  526.   oldcursor = XbWVMs_PtrActualPtr;
  527.  
  528.   cols[0] = 2;
  529.   cols[1] = 0;
  530.   cols[2] = 15;
  531.   if(XbWVMs_PtrPtrArrow == NULL) {
  532.     XbWVMs_PtrPtrArrow = GrBuildCursor(XbWVMs_PtrArrow,12,16,1,1,cols);
  533.     };
  534.   if (XbWVMs_PtrActualPtr != XbWVMs_PtrPtrArrow){
  535.     MouseSetCursor(XbWVMs_PtrPtrArrow);
  536.     };
  537.   XbWVMs_PtrActualPtr = XbWVMs_PtrPtrArrow;
  538.   return(oldcursor);
  539. #endif
  540. #ifdef XbW_SYSDEF_X11_VERSION
  541.   extern Cursor XbWVMs_PtrPtrArrow;
  542.   Cursor oldcursor;
  543.   oldcursor = XbWVMs_PtrActualPtr;
  544.   if(XbWVMs_PtrPtrArrow == 0) {
  545.     XbWVMs_PtrPtrArrow = XCreateFontCursor(XbWVSy_ConTxt.dpy,XC_left_ptr);
  546.     };
  547.   if (XbWVMs_PtrActualPtr != XbWVMs_PtrPtrArrow){
  548.     XDefineCursor(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,XbWVMs_PtrPtrArrow);
  549.     };
  550.   XbWVMs_PtrActualPtr = XbWVMs_PtrPtrArrow;
  551.   return((void  *)oldcursor);
  552. #endif
  553.   return(NULL);
  554.   };
  555. /*}}}  */
  556. /*{{{  XbWSMs_SetLastCursor(   GNU X11    Maustreiber Pfeilcursor*/
  557. void  *XbWSMs_SetLastCursor(void  *p){
  558. #ifdef XbW_SYSDEF_GNU_VERSION
  559.   extern GrCursor *XbWVMs_PtrPtrArrow;
  560.   int cols[3];
  561.  
  562.   cols[0] = 2;
  563.   cols[1] = 0;
  564.   cols[2] = 15;
  565.   if (XbWVMs_PtrActualPtr != (GrCursor *)p){
  566.     MouseSetCursor((GrCursor *)p);
  567.     XbWVMs_PtrActualPtr = (GrCursor *)p;
  568.     };
  569.   return(XbWVMs_PtrActualPtr);
  570. #endif
  571. #ifdef XbW_SYSDEF_X11_VERSION
  572.   if (XbWVMs_PtrActualPtr != (Cursor)p){
  573.     XDefineCursor(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,(Cursor)p);
  574.     XbWVMs_PtrActualPtr = (Cursor)p;
  575.     };
  576.   return((void  *)XbWVMs_PtrActualPtr);
  577. #endif
  578.   return(NULL);
  579.   };
  580. /*}}}  */
  581. /*}}}  */
  582. /*{{{  XbWSMs_XXXXXXXXXXXX(TC3,GNU,x//    Maustreiber Funktionen*/
  583. /*{{{  XbWSMs_DrInit(      TC3,GNU        Maustreiber init*/
  584. void  XbWSMs_DrInit(void){
  585.   XbWVMs_CFrm = pfeil;
  586.   XbWVMs_CX = 1; XbWVMs_CY = 1;
  587.   XbWVMs_XPos = 1;       XbWVMs_YPos = 1;   XbWVMs_CSet = 0;
  588.   if (XbWSMs_Init()==0)   {
  589. #ifdef USE_PC_SOUND
  590.     sound(2000);
  591. #endif
  592.     puts("Please connect your GENIUS Mouse !!");
  593. #ifdef USE_PC_SOUND
  594.     nosound();
  595. #endif
  596.     exit(1);
  597.     };
  598. #ifdef XbW_SYSDEF_TC3_VERSION
  599. #ifdef XbWDMs_SoftMs
  600.   XbWVMs_bits = farcalloc(1,imagesize(0,0,10,10));
  601.   if (XbWVMs_bits == NULL) {
  602. #ifdef USE_PC_SOUND
  603.     sound(2000);
  604. #endif
  605.     puts("No heap memory available!!");
  606. #ifdef USE_PC_SOUND
  607.     nosound();
  608. #endif
  609.     exit(1);
  610.     };
  611. #endif
  612. #endif
  613.  
  614. #ifdef XbW_SYSDEF_GNU_VERSION
  615.   if (MouseDetect()){
  616.     MouseEventMode(1);
  617.     MouseInit();
  618.     MouseDisplayCursor();
  619.     };
  620. #endif
  621.   XbWVMs_CSet = 0;
  622.   XbWVMs_XPos = XbWVMs_YPos = 10;
  623.   XbWVMs_CX = XbWVMs_CY = 10;
  624.   XbWVMs_CSet = 0;
  625.   XbWSMs_ON();
  626.   XbWSMs_OFF();
  627.   };
  628. /*}}}  */
  629. /*{{{  XbWSMs_DrReset(     TC3,GNU        Maustreiber rücksetzen*/
  630. void  XbWSMs_DrReset(void){
  631. #ifdef XbW_SYSDEF_TC3_VERSION
  632.   XbWVMs_CSet = 1;
  633.   XbWSMs_Hd();
  634.   while (XbWSMs_Init()==0) {
  635.     XbWSPu_Alarm("Please connect your GENIUS Mouse !!");
  636.     };
  637.   XbWSMs_ResPos();
  638.   XbWSMs_Sh();
  639. #endif
  640. #ifdef XbW_SYSDEF_GNU_VERSION
  641.   if (MouseDetect()){
  642.     MouseEventMode(1);
  643.     MouseInit();
  644.     MouseDisplayCursor();
  645.     };
  646. #endif
  647.   };
  648. /*}}}  */
  649. /*{{{  XbWSMs_Init(        TC3,GNU        Maus initialisieren*/
  650. boolean  XbWSMs_Init(void){
  651. #ifdef XbW_SYSDEF_TC3_VERSION
  652.   boolean okay;  okay = 1;
  653.   XbWFGr_MaxPort();
  654.   XbWVMs_regs.x.ax = 0;    /*Maus init */
  655.   int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  656.   if (XbWVMs_regs.x.ax == 0)   {okay = 0;}
  657.   else {okay = 1;}
  658.  
  659.   XbWVMs_CSet = 0;
  660.   if (okay == 1)   {
  661.     XbWVMs_regs.x.ax = 14;
  662.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  663.     XbWVMs_XSense = 10;
  664.     XbWVMs_YSense = 10;
  665.     XbWVMs_Speed = 20;
  666.     XbWVMs_regs.x.ax = 7;
  667.     XbWVMs_regs.x.cx = 2;
  668. #ifdef ALTER_MAUSTREIBER
  669.     XbWVMs_regs.x.dx = 640;
  670. #else
  671.     XbWVMs_regs.x.dx = XbWSGr_GtPhysX();
  672. #endif
  673.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  674.     XbWVMs_regs.x.ax = 8;
  675.     XbWVMs_regs.x.cx = 2;
  676. #ifdef ALTER_MAUSTREIBER
  677.     XbWVMs_regs.x.dx = 480;
  678. #else
  679.     XbWVMs_regs.x.dx = XbWSGr_GtPhysY();
  680. #endif
  681.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  682.  
  683.     XbWSMs_SetSens();
  684.     XbWSMs_SetSped();
  685.  
  686.   #ifdef HARDWARE_MAUS
  687.     XbWVMs_regs.x.ax = 1;
  688.     /* Cursor EIN */
  689.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  690.   #else
  691.     XbWVMs_regs.x.ax = 2;
  692.     /* Cursor AUS */
  693.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  694.   #endif
  695.     }
  696.   return okay;
  697. #endif
  698. #ifdef XbW_SYSDEF_GNU_VERSION
  699.   if (MouseDetect()){
  700.     MouseEventMode(1);
  701.     MouseInit();
  702.     MouseDisplayCursor();
  703.  
  704.     };
  705. #endif
  706. #ifdef XbW_SYSDEF_X11_VERSION
  707.   return(1);
  708. #endif
  709.   }
  710. /*}}}  */
  711. /*{{{  XbWSMs_Stop(        TC3,GNU        Ende; Interrupts freigeben*/
  712. void  XbWSMs_Stop(void){
  713.   XbWSMs_Hd();
  714. #ifdef XbW_SYSDEF_TC3_VERSION
  715.   XbWVMs_regs.x.ax = 0;    /*Maus init */
  716.   int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  717. #endif
  718. #ifdef XbW_SYSDEF_GNU_VERSION
  719.   MouseUnInit();
  720. #endif
  721.   };
  722. /*}}}  */
  723. /*{{{  XbWSMs_SetSens(     TC3,GNU        Empfindlichkeit der Maus*/
  724. void  XbWSMs_SetSens(void){
  725. #ifdef XbW_SYSDEF_TC3_VERSION
  726.     XbWVMs_regs.x.ax = 15;
  727.     XbWVMs_regs.x.cx = XbWVMs_XSense;
  728.     XbWVMs_regs.x.dx = XbWVMs_YSense;
  729.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  730. #endif
  731. #ifdef XbW_SYSDEF_GNU_VERSION
  732. #endif
  733.     };
  734. /*}}}  */
  735. /*{{{  XbWSMs_SetSped(     TC3,GNU        Geschwindigkeit der Maus*/
  736. void  XbWSMs_SetSped(void){
  737. #ifdef XbW_SYSDEF_TC3_VERSION
  738.     XbWVMs_regs.x.ax = 19;
  739.     XbWVMs_regs.x.dx = XbWVMs_Speed;
  740.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  741. #endif
  742. #ifdef XbW_SYSDEF_GNU_VERSION
  743. #endif
  744.     };
  745. /*}}}  */
  746. /*{{{  XbWSMs_Sh(          TC3,GNU        Mauscursor zeigen*/
  747. void  XbWSMs_Sh(void){
  748.   if (!XbWVMs_CSet) {
  749. #ifdef XbW_SYSDEF_TC3_VERSION
  750.  
  751. #ifndef XbWDMs_SoftMs
  752.     XbWVMs_regs.x.ax = 1;
  753.     /* Cursor EIN */
  754.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  755. #endif
  756. #endif
  757.  
  758. #ifdef XbW_SYSDEF_GNU_VERSION
  759.     if (!MouseCursorIsDisplayed()){
  760.       MouseDisplayCursor();
  761.       };
  762. #endif
  763.     XbWVMs_CSet = 1;
  764.     };
  765.   };
  766. /*}}}  */
  767. /*{{{  XbWSMs_Hd(          TC3,GNU        Mauscursor verstecken*/
  768. void  XbWSMs_Hd(void){
  769.   if (XbWVMs_CSet) {
  770. #ifdef XbW_SYSDEF_TC3_VERSION
  771.     XbWVMs_regs.x.ax = 2;
  772.     /* Cursor AUS */
  773.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  774. #endif
  775.     XbWVMs_CSet = 0;
  776. #ifdef XbW_SYSDEF_GNU_VERSION
  777.     if (MouseCursorIsDisplayed()){
  778.       MouseEraseCursor();
  779.       };
  780. #endif
  781.     };
  782.   };
  783. /*}}}  */
  784. /*{{{  XbWSMs_ON(          TC3,GNU        Startet XbWSMs_Sh*/
  785. void  XbWSMs_ON(void){
  786. #ifdef XbW_SYSDEF_TC3_VERSION
  787. #ifdef XbWDMs_SoftMs
  788.   if ((XbWVMs_XPos > XbWFGr_MaxX() - 12) | (XbWVMs_YPos > XbWFGr_MaxY() - 12)){
  789.     return;
  790.     };
  791.   if ((XbWVMs_axa != XbWVMs_XPos+XbWVIDEO_XA)|(XbWVMs_aya != XbWVMs_YPos+XbWVIDEO_YA)) {
  792.     if ((XbWVMs_aya > -30000) & (XbWVMs_axa > -30000)) {
  793.       putimage(XbWVMs_axa,XbWVMs_aya,XbWVMs_bits,COPY_PUT);
  794.       };
  795.     XbWVMs_axa = XbWVMs_XPos+XbWVIDEO_XA; XbWVMs_aya = XbWVMs_YPos+XbWVIDEO_YA;
  796.     getimage(XbWVMs_axa,XbWVMs_aya,XbWVMs_axa+10,XbWVMs_aya+10,XbWVMs_bits);
  797.     setcolor(DARKGRAY);
  798.     setfillstyle(SOLID_FILL,DARKGRAY);
  799.     bar(XbWVMs_axa+0,XbWVMs_aya+0,XbWVMs_axa+6,XbWVMs_aya+6);
  800.     line(XbWVMs_axa+9,XbWVMs_aya+7,XbWVMs_axa+9,XbWVMs_aya+9);
  801.     line(XbWVMs_axa+7,XbWVMs_aya+9,XbWVMs_axa+9,XbWVMs_aya+9);
  802.     line(XbWVMs_axa+3,XbWVMs_aya+1,XbWVMs_axa+9,XbWVMs_aya+7);
  803.     line(XbWVMs_axa+1,XbWVMs_aya+3,XbWVMs_axa+7,XbWVMs_aya+9);
  804.     setcolor(WHITE);
  805.     line(XbWVMs_axa+1,XbWVMs_aya+1,XbWVMs_axa+8,XbWVMs_aya+8);
  806.     line(XbWVMs_axa+1,XbWVMs_aya+2,XbWVMs_axa+7,XbWVMs_aya+8);
  807.     line(XbWVMs_axa+2,XbWVMs_aya+1,XbWVMs_axa+8,XbWVMs_aya+7);
  808.     line(XbWVMs_axa+1,XbWVMs_aya+1,XbWVMs_axa+1,XbWVMs_aya+5);
  809.     line(XbWVMs_axa+1,XbWVMs_aya+1,XbWVMs_axa+5,XbWVMs_aya+1);
  810.     line(XbWVMs_axa+2,XbWVMs_aya+1,XbWVMs_axa+2,XbWVMs_aya+5);
  811.     line(XbWVMs_axa+1,XbWVMs_aya+2,XbWVMs_axa+5,XbWVMs_aya+2);
  812.     };
  813.   XbWVMs_CSet = 1;
  814. #endif
  815. #endif
  816. #ifdef XbW_SYSDEF_GNU_VERSION
  817. #endif
  818.   XbWSMs_Sh();
  819.   };
  820. /*}}}  */
  821. /*{{{  XbWSMs_OFF(         TC3,GNU        Startet XbWSMs_Hd*/
  822. void  XbWSMs_OFF(void){
  823. #ifdef XbW_SYSDEF_TC3_VERSION
  824. #ifdef XbWDMs_SoftMs
  825.   if ((XbWVMs_XPos > XbWFGr_MaxX() - 12) | (XbWVMs_YPos > XbWFGr_MaxY() - 12)){
  826.     return;
  827.     };
  828.   if ((XbWVMs_axa > -30000) & (XbWVMs_aya >-30000)) {
  829.     putimage(XbWVMs_axa,XbWVMs_aya,XbWVMs_bits,COPY_PUT);
  830.     XbWVMs_axa = -30000; XbWVMs_aya = -30000;
  831.     };
  832.   XbWVMs_CSet = 0;
  833. #endif
  834. #endif
  835. #ifdef XbW_SYSDEF_GNU_VERSION
  836. #endif
  837.   XbWSMs_Hd();
  838.   };
  839. /*}}}  */
  840. /*{{{  XbWSMs_Warp(        TC3,GNU        Mauscursor verschieben*/
  841. void  XbWSMs_Warp(int x,int y){
  842. #ifdef XbW_SYSDEF_TC3_VERSION
  843.   XbWVMs_CX = x; XbWVMs_CY = y;
  844.   XbWVMs_XPos = x;   XbWVMs_YPos = y;
  845. #ifdef XbW_SYSDEF_TC3_VERSION
  846.   /*
  847.   Nun einen CALL an den Maustreiber, der die neue Position setzt.
  848.   */
  849.   XbWVMs_regs.x.ax = 4;
  850. #ifdef ALTER_MAUSTREIBER
  851.   XbWVMs_regs.x.cx = (x/2)+XbWVIDEO_XA;
  852.   XbWVMs_regs.x.dx = (y/2)+XbWVIDEO_YA;
  853. #else
  854.   XbWVMs_regs.x.cx = x+XbWVIDEO_XA;
  855.   XbWVMs_regs.x.dx = y+XbWVIDEO_YA;
  856. #endif
  857.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  858. #endif
  859. #endif
  860.  
  861. #ifdef XbW_SYSDEF_GNU_VERSION
  862.     MouseWarp(x,y);
  863. #endif
  864. #ifdef XbW_SYSDEF_X11_VERSION
  865.     XWarpPointer(
  866.       XbWVSy_ConTxt.dpy,
  867.       XbWVSy_ConTxt.window,
  868.       XbWVSy_ConTxt.window,
  869.       0,0,
  870.       1000,
  871.       1000,
  872.       x,y);
  873. #endif
  874.  
  875.   }
  876. /*}}}  */
  877. /*{{{  XbWSMs_ResPos(      TC3,GNU        Mausposition rucksetzen*/
  878. void  XbWSMs_ResPos(void){
  879.   int x,y;
  880.   x = XbWVMs_XPos; y = XbWVMs_YPos;
  881.   XbWVMs_CX = x; XbWVMs_CY = y;
  882.   /*
  883.   Nun einen CALL an den Maustreiber, der die neue Position setzt.
  884.   */
  885. #ifdef XbW_SYSDEF_TC3_VERSION
  886.   XbWVMs_regs.x.ax = 4;
  887.   XbWVMs_regs.x.cx = x+XbWVIDEO_XA;
  888.   XbWVMs_regs.x.dx = y+XbWVIDEO_YA;
  889.   int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  890. #endif
  891.  
  892. #ifdef XbW_SYSDEF_GNU_VERSION
  893.     MouseWarp(x,y);
  894. #endif
  895.   }
  896. /*}}}  */
  897. /*{{{  XbWSMs_Stat(        TC3,GNU        Tasten und Position holen*/
  898. void  XbWSMs_Stat(void){
  899. #ifdef XbW_SYSDEF_TC3_VERSION
  900.   /* Die Mausposition abfragen. */
  901.   XbWVMs_regs.x.ax = 3;
  902.   int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  903. #ifdef ALTER_MAUSTREIBER
  904.   XbWVMs_XPos = XbWVMs_regs.x.cx*2 -XbWVIDEO_XA;
  905.   XbWVMs_YPos = XbWVMs_regs.x.dx*2 -XbWVIDEO_YA;
  906. #else
  907.   XbWVMs_XPos = XbWVMs_regs.x.cx-XbWVIDEO_XA;
  908.   XbWVMs_YPos = XbWVMs_regs.x.dx-XbWVIDEO_YA;
  909. #endif
  910.  
  911.   /* Jetzt wird nachgesehen, welche Taste grdr"uckt ist. */
  912.   if ((XbWVMs_regs.x.bx & 1) == 1)   {XbWVMs_LButt = 1;}
  913.     else {XbWVMs_LButt = 0;}
  914.   if ((XbWVMs_regs.x.bx & 2) == 2)   {XbWVMs_RButt = 1;}
  915.     else {XbWVMs_RButt = 0;}
  916.   if ((XbWVMs_regs.x.bx & 4) == 4)   {XbWVMs_MButt = 1;}
  917.     else {XbWVMs_MButt = 0;}
  918. #endif
  919.  
  920. #ifdef XbW_SYSDEF_GNU_VERSION
  921.   GrCursor *tcur;
  922.   MouseEvent mev;
  923.   tcur = MouseGetCursor();
  924.   XbWVMs_XPos = tcur->cr_xcord;
  925.   XbWVMs_YPos = tcur->cr_ycord;
  926.   MouseGetEvent(M_BUTTON_DOWN|M_POLL|M_NOPAINT, &mev);
  927.   XbWVMs_LButt = XbWVMs_RButt = XbWVMs_MButt = 0;
  928.   if (mev.flags & M_BUTTON_DOWN){
  929.     if ((mev.flags)&M_LEFT_DOWN){ XbWVMs_LButt = 1; };
  930.     if ((mev.flags)&M_RIGHT_DOWN){ XbWVMs_RButt = 1; };
  931.     if ((mev.flags)&M_MIDDLE_DOWN){ XbWVMs_MButt = 1; };
  932.     };
  933. #endif
  934.  
  935.   /* XbWVMs_Button ist 1, wenn eine Maustaste gedr"uckt wurde. */
  936.   XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  937.   };
  938.  
  939. /*}}}  */
  940. /*{{{  XbWSMs_ChkMot(      TC3,GNU        Prufe, ob Maus bewegt wurde*/
  941. void  XbWSMs_ChkMot(void){
  942.   if ((XbWVMs_cxa != XbWVMs_XPos) |
  943.     (XbWVMs_cya != XbWVMs_YPos) ){
  944.     XbWVMs_Bewegt = 1;
  945.     XbWVMs_cxa = XbWVMs_XPos;
  946.     XbWVMs_cya = XbWVMs_YPos;
  947.     return;
  948.     };
  949.   XbWVMs_Bewegt = 0;
  950.   };
  951. /*}}}  */
  952. /*}}}  */
  953. /*{{{  XbWSMs_WButtXX(     TC3,GNU,X11    Maustreiber Buttons/Keyboard*/
  954. /*{{{  XbWSMs_WButtUp(*/
  955. void  XbWSMs_WButtUp(void){
  956.   while (XbWVMs_Button == 1) {
  957. #ifdef XbW_SYSDEF_TC3_VERSION
  958.     XbWVMs_regs.x.ax = 3;  /*get position */
  959.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  960.     /* Wir "ubergeben auch gleich den Zustand der Tasten. */
  961.     if ((XbWVMs_regs.x.bx & 1) == 1)   {XbWVMs_LButt = 1;}
  962.       else {XbWVMs_LButt = 0;}
  963.     if ((XbWVMs_regs.x.bx & 2) == 2)   {XbWVMs_RButt = 1;}
  964.       else {XbWVMs_RButt = 0;}
  965.     if ((XbWVMs_regs.x.bx & 4) == 4)   {XbWVMs_MButt = 1;}
  966.       else {XbWVMs_MButt = 0;}
  967. #endif
  968. #ifdef XbW_SYSDEF_GNU_VERSION
  969.     GrCursor *tcur;
  970.     MouseEvent mev;
  971.     tcur = MouseGetCursor();
  972.     XbWVMs_XPos = tcur->cr_xcord;
  973.     XbWVMs_YPos = tcur->cr_ycord;
  974.     MouseGetEvent(M_BUTTON_UP, &mev);
  975.     XbWVMs_LButt = XbWVMs_RButt = XbWVMs_MButt = 0;
  976.     if (mev.flags & M_BUTTON_DOWN){
  977.       if ((mev.flags)&M_LEFT_DOWN){ XbWVMs_LButt = 1; };
  978.       if ((mev.flags)&M_RIGHT_DOWN){ XbWVMs_RButt = 1; };
  979.       if ((mev.flags)&M_MIDDLE_DOWN){ XbWVMs_MButt = 1; };
  980.       };
  981. #endif
  982. #ifdef XbW_SYSDEF_X11_VERSION
  983.     while (!XbWVMs_Button) {
  984.       Window root,child;
  985.       int x_r,y_r, w_x,w_y;
  986.       unsigned int mask;
  987.       XQueryPointer(
  988.         XbWVSy_ConTxt.dpy,
  989.         XbWVSy_ConTxt.window,
  990.         &root,&child,
  991.         &x_r,&y_r,&w_x,&w_y,&mask);
  992.       XbWVMs_LButt = ((mask & Button1Mask) != 0);
  993.       XbWVMs_MButt = ((mask & Button2Mask) != 0);
  994.       XbWVMs_RButt = ((mask & Button3Mask) != 0);
  995.       XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  996.       };
  997.     while (XbWVMs_Button) {
  998.       Window root,child;
  999.       int x_r,y_r, w_x,w_y;
  1000.       unsigned int mask;
  1001.       XQueryPointer(
  1002.         XbWVSy_ConTxt.dpy,
  1003.         XbWVSy_ConTxt.window,
  1004.         &root,&child,
  1005.         &x_r,&y_r,&w_x,&w_y,&mask);
  1006.       XbWVMs_LButt = ((mask & Button1Mask) != 0);
  1007.       XbWVMs_MButt = ((mask & Button2Mask) != 0);
  1008.       XbWVMs_RButt = ((mask & Button3Mask) != 0);
  1009.       XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  1010.       };
  1011. #endif
  1012.     XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  1013.     }
  1014.   }
  1015. /*}}}  */
  1016. /*{{{  XbWSMs_WButtDn(     TC3,GNU,X11    Warte auf Maustaste drucken*/
  1017. void  XbWSMs_WButtDn(void){
  1018.   while (XbWVMs_Button == 0) {
  1019. #ifdef XbW_SYSDEF_TC3_VERSION
  1020.     XbWVMs_regs.x.ax = 3;  /*get position */
  1021.     int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  1022.     /* Wir "ubergeben auch gleich den Zustand der Tasten. */
  1023.     if ((XbWVMs_regs.x.bx & 1) == 1)   {XbWVMs_LButt = 1;}
  1024.       else {XbWVMs_LButt = 0;}
  1025.     if ((XbWVMs_regs.x.bx & 2) == 2)   {XbWVMs_RButt = 1;}
  1026.       else {XbWVMs_RButt = 0;}
  1027.     if ((XbWVMs_regs.x.bx & 4) == 4)   {XbWVMs_MButt = 1;}
  1028.       else {XbWVMs_MButt = 0;}
  1029. #endif
  1030. #ifdef XbW_SYSDEF_GNU_VERSION
  1031.     GrCursor *tcur;
  1032.     MouseEvent mev;
  1033.     tcur = MouseGetCursor();
  1034.     XbWVMs_XPos = tcur->cr_xcord;
  1035.     XbWVMs_YPos = tcur->cr_ycord;
  1036.     XbWVMs_LButt = XbWVMs_RButt = XbWVMs_MButt = 0;
  1037.     MouseGetEvent(M_BUTTON_DOWN, &mev);
  1038.     if ((mev.flags)&M_LEFT_DOWN){ XbWVMs_LButt = 1; };
  1039.     if ((mev.flags)&M_RIGHT_DOWN){ XbWVMs_RButt = 1; };
  1040.     if ((mev.flags)&M_MIDDLE_DOWN){ XbWVMs_MButt = 1; };
  1041. #endif
  1042. #ifdef XbW_SYSDEF_X11_VERSION
  1043.     while (XbWVMs_Button) {
  1044.       Window root,child;
  1045.       int x_r,y_r, w_x,w_y;
  1046.       unsigned int mask;
  1047.       XQueryPointer(
  1048.         XbWVSy_ConTxt.dpy,
  1049.         XbWVSy_ConTxt.window,
  1050.         &root,&child,
  1051.         &x_r,&y_r,&w_x,&w_y,&mask);
  1052.       XbWVMs_LButt = ((mask & Button1Mask) != 0);
  1053.       XbWVMs_MButt = ((mask & Button2Mask) != 0);
  1054.       XbWVMs_RButt = ((mask & Button3Mask) != 0);
  1055.       XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  1056.       };
  1057.     while (!XbWVMs_Button) {
  1058.       Window root,child;
  1059.       int x_r,y_r, w_x,w_y;
  1060.       unsigned int mask;
  1061.       XQueryPointer(
  1062.         XbWVSy_ConTxt.dpy,
  1063.         XbWVSy_ConTxt.window,
  1064.         &root,&child,
  1065.         &x_r,&y_r,&w_x,&w_y,&mask);
  1066.       XbWVMs_LButt = ((mask & Button1Mask) != 0);
  1067.       XbWVMs_MButt = ((mask & Button2Mask) != 0);
  1068.       XbWVMs_RButt = ((mask & Button3Mask) != 0);
  1069.       XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  1070.       };
  1071. #endif
  1072.     XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  1073.     };
  1074.   XbWSMs_WButtUp();
  1075.   };
  1076. /*}}}  */
  1077. /*{{{  XbWSMs_WButtUpDn(void){*/
  1078. void XbWSMs_WButtUpDn(void){
  1079.   XbWSMs_WButtUp();
  1080.   XbWSMs_WButtDn();
  1081.   };
  1082. /*}}}  */
  1083. /*{{{  XbWSMs_ConvKey(           LINUX    Funktionstasten "ubersetzen*/
  1084. char XbWSMs_ConvKey(void){
  1085.   printf("Keysym: %x\n",XbWVSy_ConTxt.keysym);
  1086.   switch(XbWVSy_ConTxt.keysym){
  1087.     case 0xFFBE: return(59); /* F1 */
  1088.     case 0xFFBF: return(60); /* F2 */
  1089.     case 0xFFC0: return(61); /* F3 */
  1090.     case 0xFFC1: return(62); /* F4 */
  1091.     case 0xFFC2: return(63); /* F5 */
  1092.     case 0xFFC3: return(64); /* F6 */
  1093.     case 0xFFC4: return(65); /* F7 */
  1094.     case 0xFFC5: return(66); /* F8 */
  1095.     case 0xFFC6: return(67); /* F9 */
  1096.     case 0xFFC7: return(68); /* F10*/
  1097.     case 0xFFC8: return(69); /* F11*/
  1098.     case 0xFFC9: return(70); /* F12*/
  1099.     case 0xFF63: return(82);   /* insert */
  1100.     case 0xFF55: return(73);   /* pgup */
  1101.     case 0xFF56: return(81);   /* pgdn */
  1102.     case 0xFF51: return(75);   /* cursor left */
  1103.     case 0xFF53: return(77);   /*        right */
  1104.     case 0xFF52: return(72);   /*        up */
  1105.     case 0xFF54: return(80);   /*        down*/
  1106.     case 0xFF50: return(71);   /* home */
  1107.     case 0xFF57: return(79);   /* end */
  1108.     default: return(0);
  1109.     };
  1110.   };
  1111.  
  1112.  
  1113. /*}}}  */
  1114. /*{{{  XbWSMs_GetKey(      TC3,GNU,X11    Aktuelle Taste holen*/
  1115. void  XbWSMs_GetKey(unsigned char  *c1, unsigned char  *c2){
  1116. #ifdef XbW_SYSDEF_TC3_VERSION
  1117.   char ch;
  1118.   ch = getch();
  1119.   if (ch != 0) {
  1120.     *c2 = ch;
  1121.     *c1 = 0;
  1122.     }
  1123.   else {
  1124.     *c1 = getch();
  1125.     *c2 = 0;
  1126.     };
  1127.   return;
  1128. #endif
  1129. #ifdef XbW_SYSDEF_GNU_VERSION
  1130.   if (!XbWVSy_ConTxt.is_a_key_waiting){
  1131.     MouseGetEvent(M_KEYPRESS, &XbWVSy_ConTxt.kbd_mev);
  1132.     };
  1133.   XbWVSy_ConTxt.is_a_key_waiting=0;
  1134.   *c1 = 0;
  1135.   /* (unsigned char)(XbWVSy_ConTxt.kbd_mev.kbstat & 0xFF);*/
  1136.   *c2 = (unsigned char)(XbWVSy_ConTxt.kbd_mev.key & 0xFF);
  1137.   if (XbWVSy_ConTxt.kbd_mev.key  & 0x100){
  1138.     *c2=0;
  1139.     *c1 = (unsigned char)(XbWVSy_ConTxt.kbd_mev.key & 0xFF);
  1140.     if (XbWVSy_ConTxt.kbd_mev.kbstat & 8){
  1141.       *c2 += 45;
  1142.       };
  1143.     if (XbWVSy_ConTxt.kbd_mev.kbstat & 4){
  1144.       *c2 += 35;
  1145.       };
  1146.     if (XbWVSy_ConTxt.kbd_mev.kbstat & 2){
  1147.       *c2 += 25;
  1148.       };
  1149.     if (XbWVSy_ConTxt.kbd_mev.kbstat & 1){
  1150.       *c2 += 25;
  1151.       };
  1152.     };
  1153. #endif
  1154. #ifdef XbW_SYSDEF_X11_VERSION
  1155.   if (XbWVSy_ConTxt.is_a_key_waiting){
  1156.     *c1 = 0;
  1157.     *c2 = XbWVSy_ConTxt.key[0];
  1158.     if (!*c2){
  1159.       *c1 = XbWSMs_ConvKey();
  1160.       };
  1161.     XbWVSy_ConTxt.is_a_key_waiting=0;
  1162.     return;
  1163.     };
  1164.   while(1){
  1165.     XEvent event;
  1166.     KeySym keysym;
  1167.     int n;
  1168.     char string[257];
  1169.     XKeyEvent *keyevent;
  1170.     XNextEvent(XbWVSy_ConTxt.dpy,&event);
  1171.     switch (event.type){
  1172.       case KeyPress:
  1173.         keyevent = (XKeyEvent *)&event;
  1174.         string[0] = 0;
  1175.         n = XLookupString(keyevent, string, 256, &keysym, NULL);
  1176.         *c1 = 0;
  1177.         *c2 = string[0];
  1178.         if (!*c2){
  1179.           *c1 = XbWSMs_ConvKey();
  1180.           };
  1181.         return;
  1182.       };
  1183.     };
  1184. #endif
  1185.   };
  1186. /*}}}  */
  1187. /*{{{  XbWSMs_IsAKey(      TC3,GNU,X11    Ist Taste gedrückt (Keyboard)*/
  1188. boolean  XbWSMs_IsAKey(int wait){
  1189. #ifdef XbW_SYSDEF_TC3_VERSION
  1190.   /* Die Mausposition abfragen. */
  1191.   XbWVMs_regs.x.ax = 3;
  1192.   int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  1193. #ifdef ALTER_MAUSTREIBER
  1194.   XbWVMs_XPos = XbWVMs_regs.x.cx*2 -XbWVIDEO_XA;
  1195.   XbWVMs_YPos = XbWVMs_regs.x.dx*2 -XbWVIDEO_YA;
  1196. #else
  1197.   XbWVMs_XPos = XbWVMs_regs.x.cx-XbWVIDEO_XA;
  1198.   XbWVMs_YPos = XbWVMs_regs.x.dx-XbWVIDEO_YA;
  1199. #endif
  1200.  
  1201.   /* Jetzt wird nachgesehen, welche Taste grdr"uckt ist. */
  1202.   if ((XbWVMs_regs.x.bx & 1) == 1)   {XbWVMs_LButt = 1;}
  1203.     else {XbWVMs_LButt = 0;}
  1204.   if ((XbWVMs_regs.x.bx & 2) == 2)   {XbWVMs_RButt = 1;}
  1205.     else {XbWVMs_RButt = 0;}
  1206.   if ((XbWVMs_regs.x.bx & 4) == 4)   {XbWVMs_MButt = 1;}
  1207.     else {XbWVMs_MButt = 0;}
  1208.   /* XbWVMs_Button ist 1, wenn eine Maustaste gedr"uckt wurde. */
  1209.   XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  1210.   XbWSMs_ChkMot();
  1211.   if (wait){
  1212.     while(!kbhit()){};
  1213.     };
  1214.   return(kbhit());
  1215. #endif
  1216. #ifdef XbW_SYSDEF_GNU_VERSION
  1217.   if (XbWVSy_ConTxt.is_a_key_waiting){
  1218.     return(1);
  1219.     };
  1220.   XbWSMs_ChkMot();
  1221.   {
  1222.     GrCursor *tcur;
  1223.     MouseEvent mev;
  1224.     tcur = MouseGetCursor();
  1225.     XbWVMs_XPos = tcur->cr_xcord;
  1226.     XbWVMs_YPos = tcur->cr_ycord;
  1227.     };
  1228.   if (wait){
  1229.     MouseGetEvent(M_BUTTON_DOWN|M_KEYPRESS, &XbWVSy_ConTxt.kbd_mev);
  1230.     }
  1231.   else {
  1232.     MouseGetEvent(M_BUTTON_DOWN|M_KEYPRESS|M_NOPAINT|M_POLL, &XbWVSy_ConTxt.kbd_mev);
  1233.     };
  1234.   XbWVMs_LButt = XbWVMs_RButt = XbWVMs_MButt = 0;
  1235.   if (XbWVSy_ConTxt.kbd_mev.flags & M_BUTTON_DOWN){
  1236.     if ((XbWVSy_ConTxt.kbd_mev.flags)&M_LEFT_DOWN){ XbWVMs_LButt = 1; };
  1237.     if ((XbWVSy_ConTxt.kbd_mev.flags)&M_RIGHT_DOWN){ XbWVMs_RButt = 1; };
  1238.     if ((XbWVSy_ConTxt.kbd_mev.flags)&M_MIDDLE_DOWN){ XbWVMs_MButt = 1; };
  1239.     };
  1240.   XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  1241.   XbWVSy_ConTxt.is_a_key_waiting = (XbWVSy_ConTxt.kbd_mev.flags & M_KEYPRESS);
  1242.   return(XbWVSy_ConTxt.is_a_key_waiting);
  1243. #endif
  1244. #ifdef XbW_SYSDEF_X11_VERSION
  1245.   if (XbWVSy_ConTxt.is_a_key_waiting){
  1246.     return(1);
  1247.     };
  1248.   {
  1249.     XEvent event;
  1250.     KeySym keysym;
  1251.     int n;
  1252.     char string[257];
  1253.     XKeyEvent *keyevent;
  1254.     while (wait){
  1255.       XNextEvent(XbWVSy_ConTxt.dpy,&event);
  1256.       switch (event.type){
  1257.         case KeyPress:
  1258.           keyevent = (XKeyEvent *)&event;
  1259.           string[0]=0;
  1260.           n = XLookupString(keyevent, string, 256, &keysym, NULL);
  1261.           XbWVSy_ConTxt.keysym = keysym;
  1262.           strncpy(XbWVSy_ConTxt.key,string,255);
  1263.           XbWVSy_ConTxt.key[255] = 0;
  1264.           XbWVSy_ConTxt.is_a_key_waiting =1;
  1265.           return(1);
  1266.         };
  1267.       };
  1268.     if (XCheckMaskEvent(XbWVSy_ConTxt.dpy,KeyPressMask,&event)){
  1269.       switch (event.type){
  1270.         case KeyPress:
  1271.           keyevent = (XKeyEvent *)&event;
  1272.           string[0]=0;
  1273.           n = XLookupString(keyevent, string, 256, &keysym, NULL);
  1274.           strncpy(XbWVSy_ConTxt.key,string,255);
  1275.           XbWVSy_ConTxt.keysym = keysym;
  1276.           XbWVSy_ConTxt.key[255] = 0;
  1277.           XbWVSy_ConTxt.is_a_key_waiting =1;
  1278.           return(1);
  1279.         };
  1280.       };
  1281.     return(0);
  1282.     };
  1283. #endif
  1284.   };
  1285. /*}}}  */
  1286. /*{{{  XbWSMs_ButUp(       TC3,GNU,X11    Ist Taste gedrueckt (Maus)*/
  1287. boolean  XbWSMs_ButUp(int wait){
  1288. #ifdef XbW_SYSDEF_TC3_VERSION
  1289.   /* Die Mausposition abfragen. */
  1290.   XbWVMs_regs.x.ax = 3;
  1291.   int86(0x33,&XbWVMs_regs,&XbWVMs_regs);
  1292. #ifdef ALTER_MAUSTREIBER
  1293.   XbWVMs_XPos = XbWVMs_regs.x.cx*2 -XbWVIDEO_XA;
  1294.   XbWVMs_YPos = XbWVMs_regs.x.dx*2 -XbWVIDEO_YA;
  1295. #else
  1296.   XbWVMs_XPos = XbWVMs_regs.x.cx-XbWVIDEO_XA;
  1297.   XbWVMs_YPos = XbWVMs_regs.x.dx-XbWVIDEO_YA;
  1298. #endif
  1299.  
  1300.   /* Jetzt wird nachgesehen, welche Taste grdr"uckt ist. */
  1301.   if ((XbWVMs_regs.x.bx & 1) == 1)   {XbWVMs_LButt = 1;}
  1302.     else {XbWVMs_LButt = 0;}
  1303.   if ((XbWVMs_regs.x.bx & 2) == 2)   {XbWVMs_RButt = 1;}
  1304.     else {XbWVMs_RButt = 0;}
  1305.   if ((XbWVMs_regs.x.bx & 4) == 4)   {XbWVMs_MButt = 1;}
  1306.     else {XbWVMs_MButt = 0;}
  1307.   /* XbWVMs_Button ist 1, wenn eine Maustaste gedr"uckt wurde. */
  1308.   XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  1309.   XbWSMs_ChkMot();
  1310.   return(XbWVMs_Button);
  1311. #endif
  1312. #ifdef XbW_SYSDEF_GNU_VERSION
  1313.   XbWSMs_ChkMot();
  1314.   {
  1315.     GrCursor *tcur;
  1316.     MouseEvent mev;
  1317.     tcur = MouseGetCursor();
  1318.     XbWVMs_XPos = tcur->cr_xcord;
  1319.     XbWVMs_YPos = tcur->cr_ycord;
  1320.     };
  1321.   if (wait){
  1322.     MouseGetEvent(M_BUTTON_UP, &XbWVSy_ConTxt.kbd_mev);
  1323.     }
  1324.   else {
  1325.     MouseGetEvent(M_BUTTON_UP|M_NOPAINT|M_POLL, &XbWVSy_ConTxt.kbd_mev);
  1326.     };
  1327.   XbWVMs_LButt = XbWVMs_RButt = XbWVMs_MButt = 1;
  1328.   if (XbWVSy_ConTxt.kbd_mev.flags & M_BUTTON_UP){
  1329.     if ((XbWVSy_ConTxt.kbd_mev.flags)&M_LEFT_UP){ XbWVMs_LButt = 0; };
  1330.     if ((XbWVSy_ConTxt.kbd_mev.flags)&M_RIGHT_UP){ XbWVMs_RButt = 0; };
  1331.     if ((XbWVSy_ConTxt.kbd_mev.flags)&M_MIDDLE_UP){ XbWVMs_MButt = 0; };
  1332.     };
  1333.   XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  1334.   return(XbWVMs_Button);
  1335. #endif
  1336. #ifdef XbW_SYSDEF_X11_VERSION
  1337.   {
  1338.     Window root, child;
  1339.     int xr, yr, xp, yp;
  1340.     unsigned int mask;
  1341.  
  1342.     XbWVMs_Button = 0;
  1343.     while(!XbWVMs_Button){
  1344.       XQueryPointer(
  1345.           XbWVSy_ConTxt.dpy,
  1346.           XbWVSy_ConTxt.window,
  1347.           &root, &child,
  1348.           &xr, &yr, &xp, &yp, &mask);
  1349.       XbWVMs_LButt = ((mask & Button1Mask) != 0);
  1350.       XbWVMs_MButt = ((mask & Button2Mask) != 0);
  1351.       XbWVMs_RButt = ((mask & Button3Mask) != 0);
  1352.       XbWVMs_Button = XbWVMs_LButt | XbWVMs_MButt | XbWVMs_RButt;
  1353.       XbWVMs_XPos=xp;
  1354.       XbWVMs_YPos=yp;
  1355.       if (!wait){
  1356.         return(XbWVMs_Button);
  1357.         };
  1358.       };
  1359.     return(XbWVMs_Button);
  1360.     };
  1361. #endif
  1362.   };
  1363. /*}}}  */
  1364. /*{{{  XbWSMs_WaitKey(     TC3,GNU,X11    Warte auf Taste (kbd)*/
  1365. void  XbWSMs_WaitKey(void){
  1366. #ifdef XbW_SYSDEF_TC3_VERSION
  1367.   while (!kbhit()){};
  1368.   return;
  1369. #endif
  1370. #ifdef XbW_SYSDEF_GNU_VERSION
  1371.   MouseGetEvent(M_KEYPRESS, &XbWVSy_ConTxt.kbd_mev);
  1372.   XbWVSy_ConTxt.is_a_key_waiting = (XbWVSy_ConTxt.kbd_mev.flags & M_KEYPRESS);
  1373.   return;
  1374. #endif
  1375. #ifdef XbW_SYSDEF_X11_VERSION
  1376.   XbWSMs_IsAKey(1);
  1377. #endif
  1378.   };
  1379. /*}}}  */
  1380. /*}}}  */
  1381. /*{{{  XbWSMs_DFramXX(     TC3,g//,x??    Rahmen zum Fenster modifizieren zeichnen*/
  1382. /*{{{  XbWSMs_DFramON(     TC3,g//,x??    Rahmen zum Fenster modifizieren zeichnen*/
  1383.  
  1384. static void *XbWSMs_DFramONFrames[4]={NULL,NULL,NULL,NULL};
  1385. void  XbWSMs_DFramON(int xa,int ya,int xb,int yb,int col){
  1386. #ifdef XbW_SYSDEF_TC3_VERSION
  1387.   int ll;
  1388.   if ((xa == xb) | (ya == yb))   { }
  1389.   else {
  1390.     if (xa > xb)   {ll = xa;xa = xb;xb = ll;};
  1391.     if (ya > yb)   {ll = ya;ya = yb;yb = ll;};
  1392.     ll = xa;
  1393.     while (ll < xb) {
  1394.       putpixel(ll,ya,getpixel(ll,ya)+XbWDMs_Pix);
  1395.       putpixel(ll,yb,getpixel(ll,yb)+XbWDMs_Pix);  ll = ll + 5;};
  1396.     ll = ya;
  1397.     while (ll < yb) {
  1398.       putpixel(xa,ll,getpixel(xa,ll)+XbWDMs_Pix);
  1399.       putpixel(xb,ll,getpixel(xb,ll)+XbWDMs_Pix);  ll = ll + 5;};
  1400.     XbWVMs_CX = xb + 2;   XbWVMs_CY = yb + 2;
  1401.     };
  1402. #endif
  1403. #ifdef XbW_SYSDEF_X11_VERSION
  1404.   XbWSMs_DFramONFrames[0] = XbWSGr_SavImag(xa,ya,xb,ya);
  1405.   XbWSMs_DFramONFrames[1] = XbWSGr_SavImag(xa,ya,xa,yb);
  1406.   XbWSMs_DFramONFrames[2] = XbWSGr_SavImag(xa,yb,xb,yb);
  1407.   XbWSMs_DFramONFrames[3] = XbWSGr_SavImag(xb,ya,xb,yb);
  1408.   XbWSGr_Line(xa,ya,xb,ya,col);
  1409.   XbWSGr_Line(xa,ya,xa,yb,col);
  1410.   XbWSGr_Line(xa,yb,xb,yb,col);
  1411.   XbWSGr_Line(xb,ya,xb,yb,col);
  1412. #endif
  1413.   };
  1414. /*}}}  */
  1415. /*{{{  XbWSMs_FramON(      TC3,g//,x??*/
  1416. void   XbWSMs_FramON(int xxa,int yya,int xxb,int yyb, int col){
  1417. #ifdef XbW_SYSDEF_TC3_VERSION
  1418.   int ll,xa,ya,xb,yb;
  1419.   xa = xxa;ya = yya;xb = xxb;yb = yyb;
  1420.   XbWFGr_MaxPort();
  1421.   if ((xa == xb) | (ya == yb)) { }
  1422.   else { if (xa > xb)   {ll = xa;xa = xb;xb = ll;};
  1423.     if (ya > yb)   {ll = ya;ya = yb;yb = ll;};
  1424.     ll = xa;
  1425.     while (ll < xb) {
  1426.       putpixel(ll,ya, getpixel(ll,ya)+XbWDMs_Pix);
  1427.       putpixel(ll,yb, getpixel(ll,yb)+XbWDMs_Pix);  ll = ll + 5;};
  1428.     ll = ya;
  1429.     while (ll < yb) {
  1430.       putpixel(xa,ll, getpixel(xa,ll)+XbWDMs_Pix);
  1431.       putpixel(xb,ll, getpixel(xb,ll)+XbWDMs_Pix);  ll = ll + 5;};
  1432.     };
  1433.   XbWVMs_CX = xb + 2;  XbWVMs_CY = yb + 2;
  1434.   XbWSMs_ON();
  1435.   XbWFGr_ResPort();
  1436. #endif
  1437. #ifdef XbW_SYSDEF_X11_VERSION
  1438.   XbWSMs_DFramONFrames[0] = XbWSGr_SavImag(xxa,yya,xxb,yya);
  1439.   if (XbWSMs_DFramONFrames[0]==NULL){ puts("ERR: cannot alloc graphic mem!"); };
  1440.   XbWSMs_DFramONFrames[1] = XbWSGr_SavImag(xxa,yya,xxa,yyb);
  1441.   if (XbWSMs_DFramONFrames[1]==NULL){ puts("ERR: cannot alloc graphic mem!"); };
  1442.   XbWSMs_DFramONFrames[2] = XbWSGr_SavImag(xxa,yyb,xxb,yyb);
  1443.   if (XbWSMs_DFramONFrames[2]==NULL){ puts("ERR: cannot alloc graphic mem!"); };
  1444.   XbWSMs_DFramONFrames[3] = XbWSGr_SavImag(xxb,yya,xxb,yyb);
  1445.   if (XbWSMs_DFramONFrames[3]==NULL){ puts("ERR: cannot alloc graphic mem!"); };
  1446.   XbWSGr_Line(xxa,yya,xxb,yya,col);
  1447.   XbWSGr_Line(xxa,yya,xxa,yyb,col);
  1448.   XbWSGr_Line(xxa,yyb,xxb,yyb,col);
  1449.   XbWSGr_Line(xxb,yya,xxb,yyb,col);
  1450. #endif
  1451.   };
  1452. /*}}}  */
  1453. /*{{{  XbWSMs_FramOFF(     TC3,g//,x??*/
  1454. void   XbWSMs_FramOFF(int xa,int ya,int xb,int yb){
  1455. #ifdef XbW_SYSDEF_TC3_VERSION
  1456.   int ll;
  1457.   if ((xa == xb) | (ya == yb))   { }
  1458.   else {
  1459.     if (xa > xb)   {ll = xa;xa = xb;xb = ll;};
  1460.     if (ya > yb)   {ll = ya;ya = yb;yb = ll;};
  1461.     ll = xa;
  1462.     while (ll < xb) {
  1463.       putpixel(ll,ya,getpixel(ll,ya)-XbWDMs_Pix);
  1464.       putpixel(ll,yb,getpixel(ll,yb)-XbWDMs_Pix);  ll = ll + 5;};
  1465.     ll = ya;
  1466.     while (ll < yb) {
  1467.       putpixel(xa,ll,getpixel(xa,ll)-XbWDMs_Pix);
  1468.       putpixel(xb,ll,getpixel(xb,ll)-XbWDMs_Pix);  ll = ll + 5;};
  1469.     XbWVMs_CX = xb + 2;  XbWVMs_CY = yb + 2;
  1470.     };
  1471. #endif
  1472. #ifdef XbW_SYSDEF_X11_VERSION
  1473.   XbWSGr_ResImag(XbWSMs_DFramONFrames[3],xb, ya, xb, yb,XbWDGr_Write);
  1474.   XbWSGr_ResImag(XbWSMs_DFramONFrames[2],xa, yb, xb, yb,XbWDGr_Write);
  1475.   XbWSGr_ResImag(XbWSMs_DFramONFrames[1],xa, ya, xa, yb,XbWDGr_Write);
  1476.   XbWSGr_ResImag(XbWSMs_DFramONFrames[0],xa, ya, xb, ya,XbWDGr_Write);
  1477. #endif
  1478.   };
  1479. /*}}}  */
  1480. /*{{{  XbWSMs_DFramOFF(    TC3,g//,x??*/
  1481. void   XbWSMs_DFramOFF(int xxa,int yya,int xxb,int yyb){
  1482. #ifdef XbW_SYSDEF_TC3_VERSION
  1483.   int ll,xa,ya,xb,yb;
  1484.   xa = xxa;ya = yya;xb = xxb;yb = yyb;
  1485.   XbWFGr_MaxPort();
  1486.   XbWSMs_OFF();
  1487.   if ((xa == xb) | (ya == yb))   { }
  1488.   else { if (xa > xb)   { ll = xa; xa = xb; xb = ll; };
  1489.     if (ya > yb)   { ll = ya;ya = yb; yb = ll; };
  1490.     ll = xa;
  1491.     while (ll < xb) {
  1492.       putpixel(ll,ya,getpixel(ll,ya)-XbWDMs_Pix);
  1493.       putpixel(ll,yb,getpixel(ll,yb)-XbWDMs_Pix);  ll = ll + 5;};
  1494.     ll = ya;
  1495.     while (ll < yb) {
  1496.       putpixel(xa,ll,getpixel(xa,ll)-XbWDMs_Pix);
  1497.       putpixel(xb,ll,getpixel(xb,ll)-XbWDMs_Pix);  ll = ll + 5;};
  1498.     };
  1499.   XbWFGr_ResPort();
  1500. #endif
  1501. #ifdef XbW_SYSDEF_X11_VERSION
  1502.   XbWSGr_ResImag(XbWSMs_DFramONFrames[0],xxa, yya, xxb, yya,XbWDGr_Write);
  1503.   XbWSGr_ResImag(XbWSMs_DFramONFrames[1],xxa, yya, xxa, yyb,XbWDGr_Write);
  1504.   XbWSGr_ResImag(XbWSMs_DFramONFrames[2],xxa, yyb, xxb, yyb,XbWDGr_Write);
  1505.   XbWSGr_ResImag(XbWSMs_DFramONFrames[3],xxb, yya, xxb, yyb,XbWDGr_Write);
  1506. #endif
  1507.   };
  1508. /*}}}  */
  1509. /*}}}  */
  1510. /*{{{  XbWSGr_BitXXXX(     t--,GNU,x//    Bit-Blitter fur Grafik*/
  1511. /*{{{  XbWSGr_BitBlit(     t--,GNU,x//    Bit-Blitter fur Grafik*/
  1512. void  XbWSGr_BitBlit(void  *dest, int x, int y,
  1513.                void  *source, int x1, int y1, int x2, int y2,
  1514.                int oper){
  1515. #ifdef XbW_SYSDEF_GNU_VERSION
  1516.   GrBitBlt((GrContext *)dest,x,y,(GrContext *)source,x1,y1,x2,y2,oper);
  1517. #endif
  1518. #ifdef XbW_SYSDEF_X11_VERSION
  1519.   XCopyArea(
  1520.     XbWVSy_ConTxt.dpy,
  1521.     XbWVSy_ConTxt.window,
  1522.     XbWVSy_ConTxt.window,
  1523.     XbWVSy_ConTxt.gc,
  1524.     x1,y1,
  1525.     x2-x1,y2-y1,
  1526.     x,y);
  1527. #endif
  1528.   };
  1529. /*}}}  */
  1530. /*{{{  XbWSGr_SavImag(     TC3,GNU,x//    Blit Image in Memory-Context*/
  1531. void  *XbWSGr_SavImag(int x1, int y1, int x2, int y2){
  1532. #ifdef XbW_SYSDEF_TC3_VERSION
  1533.   void far *scrinh;
  1534.   if (imagesize(x1,y1,x2+1,y2+1) == (unsigned)(0xFFFF-1)){
  1535.     return(NULL);
  1536.     };
  1537.   if((scrinh = farcalloc(1,imagesize(x1,y1,x2+1,y2+1))) == NULL){
  1538.     return(scrinh);
  1539.     };
  1540.   getimage(x1,y1,x2,y2,scrinh);
  1541.   return(scrinh);
  1542. #endif
  1543. #ifdef XbW_SYSDEF_GNU_VERSION
  1544.   GrContext *tc;
  1545.   tc = GrCreateContext(x2-x1+2,y2-y1+2,NULL,NULL);
  1546.   if (tc==NULL){ return(tc);};
  1547.   GrBitBlt(tc,0,0,NULL,x1,y1,x2+1,y2+1,GrWRITE);
  1548.   return(tc);
  1549. #endif
  1550. #ifdef XbW_SYSDEF_X11_VERSION
  1551.   Pixmap *pmap;
  1552.   pmap = XbWSSy_AlocMem(sizeof(Pixmap),1);
  1553.   if (pmap==NULL){ return(NULL); };
  1554.  
  1555.   *pmap = XCreatePixmap(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,x2-x1+2,y2-y1+2,
  1556.       XDefaultDepthOfScreen(XbWVSy_ConTxt.screen));
  1557.   if (*pmap<=0){ return(NULL);};
  1558.  
  1559.   XCopyArea(XbWVSy_ConTxt.dpy,
  1560.     XbWVSy_ConTxt.window, /* src */
  1561.     *pmap,                /* target */
  1562.     XbWVSy_ConTxt.gc,
  1563.     x1,y1,
  1564.     x2-x1+1,y2-y1+1,
  1565.     1,1);
  1566.   return(pmap);
  1567. #endif
  1568.   return(NULL);
  1569.   };
  1570. /*}}}  */
  1571. /*{{{  XbWSGr_ResImag(     TC3,GNU,x//    Blit Image aus Memory-Context*/
  1572. void  XbWSGr_ResImag(void  *where,int x1, int y1,
  1573.   int x2, int y2,
  1574.   int oper){
  1575. /*{{{  */
  1576. #ifdef XbW_SYSDEF_TC3_VERSION
  1577.   switch(oper){
  1578.     case XbWDGr_Write: oper = COPY_PUT; break;
  1579.     case XbWDGr_XOR:   oper = XOR_PUT; break;
  1580.     case XbWDGr_OR:    oper = OR_PUT; break;
  1581.     case XbWDGr_AND:   oper = AND_PUT; break;
  1582.     };
  1583.   putimage(x1,y1,where,oper);
  1584.   farfree(where);
  1585. #endif
  1586. #ifdef XbW_SYSDEF_GNU_VERSION
  1587.   switch(oper){
  1588.     case XbWDGr_Write: oper = GrWRITE; break;
  1589.     case XbWDGr_XOR:   oper = GrXOR; break;
  1590.     case XbWDGr_OR:    oper = GrOR; break;
  1591.     case XbWDGr_AND:   oper = GrAND; break;
  1592.     };
  1593.   GrBitBlt(NULL,x1,y1,(GrContext *)where,0,0,x2-x1+1,y2-y1+1,oper);
  1594.   GrDestroyContext(where);
  1595. #endif
  1596. /*}}}  */
  1597. #ifdef XbW_SYSDEF_X11_VERSION
  1598.   Pixmap *pmap;
  1599.   pmap = where;
  1600.   if (pmap==NULL){ return; };
  1601.  
  1602.   XCopyArea(XbWVSy_ConTxt.dpy,
  1603.     *pmap,                /* src */
  1604.     XbWVSy_ConTxt.window, /* dest */
  1605.     XbWVSy_ConTxt.gc,
  1606.     1,1,
  1607.     x2-x1+1,y2-y1+1,
  1608.     x1,y1);
  1609.   XFreePixmap(XbWVSy_ConTxt.dpy,*pmap);
  1610.   XbWSSy_FreeMem(pmap);
  1611. #endif
  1612.   };
  1613. /*}}}  */
  1614. /*{{{  XbWSGr_DelImag(     TC3,GNU,x//    Memory-Context loeschen*/
  1615. void  XbWSGr_DelImag(void  *where){
  1616. #ifdef XbW_SYSDEF_TC3_VERSION
  1617.   farfree(where);
  1618. #endif
  1619. #ifdef XbW_SYSDEF_GNU_VERSION
  1620.   GrDestroyContext(where);
  1621. #endif
  1622. #ifdef XbW_SYSDEF_X11_VERSION
  1623.   Pixmap *pmap;
  1624.   pmap = where;
  1625.   if (pmap==NULL){ return; };
  1626.  
  1627.   XFreePixmap(XbWVSy_ConTxt.dpy,*pmap);
  1628.   XbWSSy_FreeMem(pmap);
  1629. #endif
  1630.   };
  1631. /*}}}  */
  1632. /*{{{  XbWSGr_CopImag(     TC3,GNU,x//    Blit Image aus Memory-Context*/
  1633. void  XbWSGr_CopImag(void  *where,int x1, int y1,
  1634.   int x2, int y2,
  1635.   int oper){
  1636. #ifdef XbW_SYSDEF_TC3_VERSION
  1637.   switch(oper){
  1638.     case XbWDGr_Write: oper = COPY_PUT; break;
  1639.     case XbWDGr_XOR:   oper = XOR_PUT; break;
  1640.     case XbWDGr_OR:    oper = OR_PUT; break;
  1641.     case XbWDGr_AND:   oper = AND_PUT; break;
  1642.     };
  1643.   putimage(x1,y1,where,oper);
  1644. #endif
  1645. #ifdef XbW_SYSDEF_GNU_VERSION
  1646.   switch(oper){
  1647.     case XbWDGr_Write: oper = GrWRITE; break;
  1648.     case XbWDGr_XOR:   oper = GrXOR; break;
  1649.     case XbWDGr_OR:    oper = GrOR; break;
  1650.     case XbWDGr_AND:   oper = GrAND; break;
  1651.     };
  1652.   GrBitBlt(NULL,x1,y1,(GrContext *)where,0,0,x2-x1+1,y2-y1+1,oper);
  1653.   XCopyArea(XbWVSy_ConTxt.dpy,
  1654.     *pmap,                 /* src */
  1655.     XbWVSy_ConTxt.window,  /* dest */
  1656.     XbWVSy_ConTxt.gc,
  1657.     0,0,
  1658.     x2-x1+1,y2-y1+1,
  1659.     x1,y1);
  1660. #endif
  1661.   };
  1662. /*}}}  */
  1663.  
  1664. /*{{{  XbWSGr_Line(        TC3,GNU        Linie zeichnen*/
  1665. void  XbWSGr_Line(int xa,int ya,int xb,int yb,unsigned char color){
  1666. #ifdef XbW_SYSDEF_TC3_VERSION
  1667.   setcolor(color); line(xa,ya,xb,yb);
  1668. #endif
  1669. #ifdef XbW_SYSDEF_GNU_VERSION
  1670.   GrLine(xa+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,xb+XbWVSy_ConTxt.XA,yb+XbWVSy_ConTxt.YA,color);
  1671. #endif
  1672. #ifdef XbW_SYSDEF_X11_VERSION
  1673.   XSetForeground(XbWVSy_ConTxt.dpy,
  1674.     XbWVSy_ConTxt.gc,
  1675.     XbWVGr_ColorValues[color]);
  1676.   XSetLineAttributes(
  1677.     XbWVSy_ConTxt.dpy,
  1678.     XbWVSy_ConTxt.gc,
  1679.     1,
  1680.     LineSolid,
  1681.     CapRound,
  1682.     JoinRound);
  1683.  
  1684.   if (xa < 0){ xa = 0; };
  1685.   if (ya < 0){ ya = 0; };
  1686.   if (xb < 0){ xb = 0; };
  1687.   if (yb < 0){ yb = 0; };
  1688.   if (xb < 0 ) { xa = -xb; xb = 0; };
  1689.   if (yb < 0 ) { ya = -yb; yb = 0; };
  1690.   if ( (xa != xb) || (ya != yb)) {
  1691.     XDrawLine(
  1692.       XbWVSy_ConTxt.dpy,
  1693.       XbWVSy_ConTxt.window,
  1694.       XbWVSy_ConTxt.gc,
  1695.       xa+XbWVSy_ConTxt.XA,
  1696.       ya+XbWVSy_ConTxt.YA,
  1697.       xb+XbWVSy_ConTxt.XA,
  1698.       yb+XbWVSy_ConTxt.YA);
  1699.     };
  1700. #endif
  1701.   };
  1702. /*}}}  */
  1703. /*{{{  XbWSGr_HLin(        TC3,GNU        Horizontale Linie (schnell)*/
  1704. void  XbWSGr_HLin(int xa,int xb,int ya,unsigned char color){
  1705. #ifdef XbW_SYSDEF_TC3_VERSION
  1706.   setcolor(color); line(xa,ya,xb,ya);
  1707. #endif
  1708. #ifdef XbW_SYSDEF_GNU_VERSION
  1709.   GrHLine(xa+XbWVSy_ConTxt.XA,xb+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,color);
  1710. #endif
  1711. #ifdef XbW_SYSDEF_X11_VERSION
  1712.   XbWSGr_Line(xa,ya,xb,ya,color);
  1713. #endif
  1714.   };
  1715. /*}}}  */
  1716. /*{{{  XbWSGr_VLin(        TC3,GNU        Vertikale Linie (schnell)*/
  1717. void  XbWSGr_VLin(int xa,int ya,int yb,unsigned char color){
  1718. #ifdef XbW_SYSDEF_TC3_VERSION
  1719.   setcolor(color); line(xa,ya,xa,yb);
  1720. #endif
  1721. #ifdef XbW_SYSDEF_GNU_VERSION
  1722.   GrVLine(xa+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,yb+XbWVSy_ConTxt.YA,color);
  1723. #endif
  1724. #ifdef XbW_SYSDEF_X11_VERSION
  1725.   XbWSGr_Line(xa,ya,xa,yb,color);
  1726. #endif
  1727.   };
  1728. /*}}}  */
  1729. /*{{{  XbWSGr_Ell(         TC3,!!!        Kreis bzw. Ellipse*/
  1730. void  XbWSGr_Ell(int xa,int ya,int stang,int endang,
  1731.               int ra,int rb,int farbe){
  1732. #ifdef XbW_SYSDEF_TC3_VERSION
  1733.   setcolor(farbe);
  1734.   ellipse(xa,ya,stang,endang,ra,rb);
  1735. #endif
  1736.   };
  1737. /*}}}  */
  1738. /*}}}  */
  1739. /*{{{  XbWSGr_TxtXXXX(     t--,GNU,X11    Textstring als Grafik ausg.*/
  1740. /*{{{  XbWSGr_TxtDraw(     t--,GNU,X11    Textstring als Grafik ausg.*/
  1741. void  XbWSGr_TxtDraw(int x, int y,char *txt,  int tc, int bc){
  1742. #ifdef XbW_SYSDEF_GNU_VERSION
  1743.   XbWVSy_ConTxt.top.txo_fgcolor.v = (int)tc;
  1744. /*  XbWVSy_ConTxt.top.txo_bgcolor.v = (int)bc; */
  1745.   XbWVSy_ConTxt.top.txo_bgcolor.v = GrNOCOLOR;
  1746.   GrDrawString(txt,strlen(txt),x,y,&XbWVSy_ConTxt.top);
  1747. #endif
  1748.   };
  1749. /*}}}  */
  1750. /*{{{  XbWSGr_TLBox(       TC3,GNU,X11    Text-Box, linksbundig, oben*/
  1751. void  XbWSGr_TLBox(
  1752.   int xa,int ya,
  1753.   int xb,int yb,
  1754.   char  *msg,
  1755.   int fillcol, int textcol, int framecol){
  1756. #ifdef XbW_SYSDEF_TC3_VERSION
  1757.   if (xb){
  1758.     setfillstyle(SOLID_FILL,fillcol);
  1759.     bar(xa,ya,xb,yb);
  1760.     };
  1761.   setcolor(textcol);
  1762.   if (msg!=NULL) {
  1763.     outtextxy(xa+1,ya+2,(char far *)msg);
  1764.     };
  1765.   if (xb){
  1766.     setcolor(framecol);
  1767.     line(xa,ya,xb,ya);
  1768.     line(xa,ya,xa,yb);
  1769.     line(xb,yb,xb,ya);
  1770.     line(xb,yb,xa,yb);
  1771.     };
  1772. #endif
  1773.  
  1774. #ifdef XbW_SYSDEF_GNU_VERSION
  1775.   if (xb!=0){
  1776.  
  1777.     GrFilledBox(xa+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,xb+XbWVSy_ConTxt.XA,yb+XbWVSy_ConTxt.YA,fillcol);
  1778.     };
  1779.   if (msg!=NULL) {
  1780.     XbWSGr_TxtDraw(xa+1+XbWVSy_ConTxt.XA,ya+2+XbWVSy_ConTxt.YA,msg,textcol,fillcol);
  1781.     };
  1782.   if (xb!=0){
  1783.     GrHLine(xa+XbWVSy_ConTxt.XA,xb+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,framecol);
  1784.     GrHLine(xa+XbWVSy_ConTxt.XA,xb+XbWVSy_ConTxt.XA,yb+XbWVSy_ConTxt.YA,framecol);
  1785.     GrVLine(xa+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,yb+XbWVSy_ConTxt.YA,framecol);
  1786.     GrVLine(xb+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,yb+XbWVSy_ConTxt.YA,framecol);
  1787.     };
  1788. #endif
  1789.  
  1790. #ifdef XbW_SYSDEF_X11_VERSION
  1791.   if (xb!=0){
  1792.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  1793.       XbWVGr_ColorValues[fillcol] );
  1794.     XFillRectangle(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,
  1795.       XbWVSy_ConTxt.gc,
  1796.       xa+XbWVSy_ConTxt.XA,
  1797.       ya+XbWVSy_ConTxt.YA,xb-xa,yb-ya);
  1798.       };
  1799.   if (msg!=NULL) {
  1800.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  1801.       XbWVGr_ColorValues[textcol] );
  1802.     XDrawString(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window,XbWVSy_ConTxt.gc,
  1803.       xa+1+XbWVSy_ConTxt.XA,
  1804.       ya+XbWFGr_THeight()-2+XbWVSy_ConTxt.YA,
  1805.       msg,strlen(msg));
  1806.     };
  1807.   if (xb!=0){
  1808.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  1809.       XbWVGr_ColorValues[framecol] );
  1810.     XDrawRectangle(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,
  1811.       XbWVSy_ConTxt.gc,
  1812.       xa+XbWVSy_ConTxt.XA,
  1813.       ya+XbWVSy_ConTxt.YA,
  1814.       xb-xa,yb-ya);
  1815.     };
  1816. #endif
  1817.   };
  1818. /*}}}  */
  1819. /*{{{  XbWSGr_CCBox(       TC3,GNU,X11    Text-Box, zentriert*/
  1820. void  XbWSGr_CCBox(
  1821.   int xa,int ya,
  1822.   int xb,int yb,
  1823.   char  *msg,
  1824.   int fillcol, int textcol, int framecol){
  1825. #ifdef XbW_SYSDEF_TC3_VERSION
  1826.   if (xb){
  1827.     setcolor(framecol);
  1828.     setfillstyle(SOLID_FILL,fillcol);
  1829.     bar(xa,ya,xb,yb);
  1830.     };
  1831.   setcolor(textcol);
  1832.   if (msg!=NULL) {
  1833.     outtextxy(
  1834.       (xa+xb)/2-(XbWFGr_TWidth((char*)msg)/2),
  1835.       (ya+yb)/2-XbWFGr_THeight()/2+2,
  1836.       (char far *)msg);
  1837.     };
  1838.   if (xb){
  1839.     setcolor(framecol);
  1840.     line(xa,ya,xb,ya);
  1841.     line(xa,ya,xa,yb);
  1842.     line(xb,yb,xb,ya);
  1843.     line(xb,yb,xa,yb);
  1844.     };
  1845. #endif
  1846.  
  1847. #ifdef XbW_SYSDEF_GNU_VERSION
  1848.   if (xb){
  1849.     GrFilledBox(xa+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,xb+XbWVSy_ConTxt.XA,yb+XbWVSy_ConTxt.YA,fillcol);
  1850.     };
  1851.   if (msg != NULL) {
  1852.     XbWSGr_TxtDraw(
  1853.       (xa+XbWVSy_ConTxt.XA+xb+XbWVSy_ConTxt.XA)/2-(XbWFGr_TWidth(msg)/2),
  1854.       (ya+XbWVSy_ConTxt.YA+yb+XbWVSy_ConTxt.YA)/2-XbWFGr_THeight()/2+2,
  1855.       msg,textcol,fillcol);
  1856.     };
  1857.   if (xb){
  1858.     GrHLine(xa+XbWVSy_ConTxt.XA,xb+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,framecol);
  1859.     GrHLine(xa+XbWVSy_ConTxt.XA,xb+XbWVSy_ConTxt.XA,yb+XbWVSy_ConTxt.YA,framecol);
  1860.     GrVLine(xa+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,yb+XbWVSy_ConTxt.YA,framecol);
  1861.     GrVLine(xb+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,yb+XbWVSy_ConTxt.YA,framecol);
  1862.     };
  1863. #endif
  1864. #ifdef XbW_SYSDEF_X11_VERSION
  1865.   if (xb!=0){
  1866.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  1867.       XbWVGr_ColorValues[fillcol] );
  1868.     XFillRectangle(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,
  1869.       XbWVSy_ConTxt.gc,
  1870.       xa+XbWVSy_ConTxt.XA,
  1871.       ya+XbWVSy_ConTxt.YA,xb-xa,yb-ya);
  1872.       };
  1873.   if (msg!=NULL) {
  1874.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  1875.       XbWVGr_ColorValues[textcol] );
  1876.     XDrawString(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window,XbWVSy_ConTxt.gc,
  1877.       (xa+XbWVSy_ConTxt.XA+xb+XbWVSy_ConTxt.XA)/2-(XbWFGr_TWidth(msg)/2),
  1878.       (ya+XbWVSy_ConTxt.YA+yb+XbWVSy_ConTxt.YA)/2+XbWFGr_THeight()/2+2,
  1879.       msg,strlen(msg));
  1880.     };
  1881.   if (xb!=0){
  1882.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  1883.       XbWVGr_ColorValues[framecol] );
  1884.     XDrawRectangle(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,
  1885.       XbWVSy_ConTxt.gc,
  1886.       xa+XbWVSy_ConTxt.XA,
  1887.       ya+XbWVSy_ConTxt.YA,
  1888.       xb-xa,yb-ya);
  1889.     };
  1890. #endif
  1891.   };
  1892. /*}}}  */
  1893. /*{{{  XbWSGr_BCBox(       TC3,GNU,X11    Text-Box, unten zentriert*/
  1894. void  XbWSGr_BCBox(
  1895.   int xa,int ya,
  1896.   int xb,int yb,
  1897.   char  *msg,
  1898.   int fillcol, int textcol, int framecol){
  1899.   ya = yb - XbWFGr_THeight()-2;
  1900. #ifdef XbW_SYSDEF_TC3_VERSION
  1901.   if (xb){
  1902.     setcolor(framecol);
  1903.     setfillstyle(SOLID_FILL,fillcol);
  1904.     bar(xa,ya,xb,yb);
  1905.     };
  1906.   setcolor(textcol);
  1907.   if (msg!=NULL) {
  1908.     outtextxy(
  1909.       (xa+xb)/2-(XbWFGr_TWidth((char*)msg)/2),
  1910.       ya,
  1911.       (char far *)msg);
  1912.     };
  1913.   if (xb){
  1914.     setcolor(framecol);
  1915.     line(xa,ya,xb,ya);
  1916.     line(xa,ya,xa,yb);
  1917.     line(xb,yb,xb,ya);
  1918.     line(xb,yb,xa,yb);
  1919.     };
  1920. #endif
  1921.  
  1922. #ifdef XbW_SYSDEF_GNU_VERSION
  1923.   if (xb){
  1924.     GrFilledBox(xa+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,xb+XbWVSy_ConTxt.XA,yb+XbWVSy_ConTxt.YA,fillcol);
  1925.     };
  1926.   if (msg != NULL) {
  1927.     XbWSGr_TxtDraw(
  1928.       (xa+XbWVSy_ConTxt.XA+xb+XbWVSy_ConTxt.XA)/2-(XbWFGr_TWidth(msg)/2),
  1929.       ya+XbWVSy_ConTxt.YA,
  1930.       msg,textcol,fillcol);
  1931.     };
  1932.   if (xb){
  1933.     GrHLine(xa+XbWVSy_ConTxt.XA,xb+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,framecol);
  1934.     GrHLine(xa+XbWVSy_ConTxt.XA,xb+XbWVSy_ConTxt.XA,yb+XbWVSy_ConTxt.YA,framecol);
  1935.     GrVLine(xa+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,yb+XbWVSy_ConTxt.YA,framecol);
  1936.     GrVLine(xb+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,yb+XbWVSy_ConTxt.YA,framecol);
  1937.     };
  1938. #endif
  1939. #ifdef XbW_SYSDEF_X11_VERSION
  1940.   if (xb!=0){
  1941.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  1942.       XbWVGr_ColorValues[fillcol] );
  1943.     XFillRectangle(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,
  1944.       XbWVSy_ConTxt.gc,
  1945.       xa+XbWVSy_ConTxt.XA,
  1946.       ya+XbWVSy_ConTxt.YA,xb-xa,yb-ya);
  1947.       };
  1948.   if (msg!=NULL) {
  1949.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  1950.       XbWVGr_ColorValues[textcol] );
  1951.     XDrawString(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window,XbWVSy_ConTxt.gc,
  1952.       (xa+XbWVSy_ConTxt.XA+xb+XbWVSy_ConTxt.XA)/2-(XbWFGr_TWidth(msg)/2),
  1953.       ya+XbWVSy_ConTxt.YA+XbWFGr_THeight(),
  1954.       msg,strlen(msg));
  1955.     };
  1956.   if (xb!=0){
  1957.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  1958.       XbWVGr_ColorValues[framecol] );
  1959.     XDrawRectangle(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,
  1960.       XbWVSy_ConTxt.gc,
  1961.       xa+XbWVSy_ConTxt.XA,
  1962.       ya+XbWVSy_ConTxt.YA,
  1963.       xb-xa,yb-ya);
  1964.     };
  1965. #endif
  1966.   };
  1967. /*}}}  */
  1968. /*{{{  XbWSGr_RBBox(       TC3,GNU,X11    Text-Box rechts unten aligned*/
  1969. void  XbWSGr_RBBox(
  1970.   int xa,int ya,
  1971.   int xb,int yb,
  1972.   char  *msg,
  1973.   int fillcol, int textcol, int framecol){
  1974. #ifdef XbW_SYSDEF_TC3_VERSION
  1975.   if (xb){
  1976.     setcolor(framecol);
  1977.     setfillstyle(SOLID_FILL,fillcol);
  1978.     bar(xa,ya,xb,yb);
  1979.     };
  1980.   setcolor(textcol);
  1981.   if (msg!=NULL) {
  1982.     outtextxy(
  1983.       xb-2-XbWFGr_TWidth((char*)msg),
  1984.       yb+2-XbWFGr_THeight(),(char far *)msg);
  1985.     };
  1986.   if (xb){
  1987.     setcolor(framecol);
  1988.     line(xa,ya,xb,ya);
  1989.     line(xa,ya,xa,yb);
  1990.     line(xb,yb,xb,ya);
  1991.     line(xb,yb,xa,yb);
  1992.     };
  1993. #endif
  1994.  
  1995. #ifdef XbW_SYSDEF_GNU_VERSION
  1996.   if (xb){
  1997.     GrFilledBox(xa+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,xb+XbWVSy_ConTxt.XA,yb+XbWVSy_ConTxt.YA,fillcol);
  1998.     };
  1999.   if (msg!=NULL) {
  2000.     XbWSGr_TxtDraw(
  2001.       xb+XbWVSy_ConTxt.XA-2-XbWFGr_TWidth(msg),
  2002.       yb+XbWVSy_ConTxt.YA+2-XbWFGr_THeight(),msg,textcol,fillcol);
  2003.     };
  2004.   if (xb){
  2005.     GrHLine(xa+XbWVSy_ConTxt.XA,xb+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,framecol);
  2006.     GrHLine(xa+XbWVSy_ConTxt.XA,xb+XbWVSy_ConTxt.XA,yb+XbWVSy_ConTxt.YA,framecol);
  2007.     GrVLine(xa+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,yb+XbWVSy_ConTxt.YA,framecol);
  2008.     GrVLine(xb+XbWVSy_ConTxt.XA,ya+XbWVSy_ConTxt.YA,yb+XbWVSy_ConTxt.YA,framecol);
  2009.     };
  2010. #endif
  2011. #ifdef XbW_SYSDEF_X11_VERSION
  2012.   if (xb!=0){
  2013.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  2014.       XbWVGr_ColorValues[fillcol] );
  2015.     XFillRectangle(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,
  2016.       XbWVSy_ConTxt.gc,
  2017.       xa+XbWVSy_ConTxt.XA,
  2018.       ya+XbWVSy_ConTxt.YA,xb-xa,yb-ya);
  2019.       };
  2020.   if (msg!=NULL) {
  2021.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  2022.       XbWVGr_ColorValues[textcol] );
  2023.     XDrawString(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window,XbWVSy_ConTxt.gc,
  2024.       xb+XbWVSy_ConTxt.XA-2-XbWFGr_TWidth(msg),
  2025.       yb+XbWVSy_ConTxt.YA-1,
  2026.       msg,strlen(msg));
  2027.     };
  2028.   if (xb!=0){
  2029.     XSetForeground(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.gc,
  2030.       XbWVGr_ColorValues[framecol] );
  2031.     XDrawRectangle(XbWVSy_ConTxt.dpy,XbWVSy_ConTxt.window,
  2032.       XbWVSy_ConTxt.gc,
  2033.       xa+XbWVSy_ConTxt.XA,
  2034.       ya+XbWVSy_ConTxt.YA,
  2035.       xb-xa,yb-ya);
  2036.     };
  2037. #endif
  2038.   };
  2039. /*}}}  */
  2040. /*{{{  XbWSGr_GotoXY(      ???,TC3*/
  2041. void  XbWSGr_GotoXY(int x, int y){
  2042. #ifdef XbW_SYSDEF_TC3_VERSION
  2043.   gotoxy(x,y);
  2044. #endif
  2045.   };
  2046. /*}}}  */
  2047. /*}}}  */
  2048. /*{{{  XbWSWd_XXXXXX(      TC3,GNU,X!!    Aktuelle Fenstergrosse andern*/
  2049. /*{{{  XbWSWd_Resize(      TC3,GNU,X!!    Aktuelle Fenstergrosse andern*/
  2050. void  XbWSWd_Resize(void  *(*p)[]){
  2051. #ifdef XbW_SYSDEF_TC3_VERSION
  2052.   int Mausx,Mausy;
  2053. #endif
  2054.   int SizeXneu,SizeYneu;
  2055.   SizeXneu = *XbWVWd_W.sx;
  2056.   SizeYneu = *XbWVWd_W.sy;
  2057. #ifdef XbW_SYSDEF_TC3_VERSION
  2058.   XbWSMs_FramON(*XbWVWd_W.nx,*XbWVWd_W.ny,*XbWVWd_W.nx+*XbWVWd_W.sx,*XbWVWd_W.ny+*XbWVWd_W.sy,14);
  2059.   while (XbWVMs_Button==1)  {
  2060.     Mausx = XbWVMs_XPos; Mausy = XbWVMs_YPos;
  2061.     XbWSMs_Stat(); XbWSMs_ChkMot();
  2062.     if (XbWVMs_Bewegt==1) {
  2063.       Mausx = XbWVMs_XPos-Mausx; Mausy = XbWVMs_YPos-Mausy;
  2064.       XbWFGr_MaxPort();
  2065.       XbWSMs_DFramOFF(*XbWVWd_W.nx,*XbWVWd_W.ny,*XbWVWd_W.nx+SizeXneu,*XbWVWd_W.ny+SizeYneu);
  2066.       SizeXneu = SizeXneu + Mausx;
  2067.       SizeYneu = SizeYneu + Mausy;
  2068.       XbWSMs_FramON(*XbWVWd_W.nx,*XbWVWd_W.ny,*XbWVWd_W.nx+SizeXneu,*XbWVWd_W.ny+SizeYneu,14);
  2069.       };
  2070.     };
  2071.   XbWFGr_CurOFF();
  2072.   XbWFWd_BackGr();
  2073.   XbWFGr_CurOFF();
  2074.   *XbWVWd_W.sx = SizeXneu;
  2075.   *XbWVWd_W.sy = SizeYneu;
  2076. #endif
  2077. #ifdef XbW_SYSDEF_GNU_VERSION
  2078.   {
  2079.     int ende = 0;
  2080.     MouseEvent mev;
  2081.     XbWSMs_SetHandCursor();
  2082.     MouseWarp(*XbWVWd_W.nx+SizeXneu,*XbWVWd_W.ny+SizeYneu);
  2083.     MouseSetCursorMode(M_CUR_RUBBER,*XbWVWd_W.nx,*XbWVWd_W.ny,15);
  2084.     MouseGetEvent(M_BUTTON_UP, &mev);
  2085.     SizeXneu = mev.x;
  2086.     SizeYneu = mev.y;
  2087.     MouseSetCursorMode(M_CUR_NORMAL);
  2088.     XbWFGr_CurOFF();
  2089.     XbWFWd_BackGr();
  2090.     XbWFGr_CurOFF();
  2091.     XbWSMs_SetArrowCursor();
  2092.     if (SizeXneu > *XbWVWd_W.nx + 10){
  2093.       *XbWVWd_W.sx = SizeXneu-*XbWVWd_W.nx;
  2094.       };
  2095.     if (SizeYneu > *XbWVWd_W.ny + 10){
  2096.       *XbWVWd_W.sy = SizeYneu-*XbWVWd_W.ny;
  2097.       };
  2098.     };
  2099. #endif
  2100. #ifdef XbW_SYSDEF_X11_VERSION
  2101.   {
  2102.     int ende = 0;
  2103.     Window root, child;
  2104.     int xr, yr, xp, yp;
  2105.     unsigned int mask;
  2106.  
  2107.     XbWFGr_MaxPort();
  2108.     XbWVMs_XPos = *XbWVWd_W.nx+*XbWVWd_W.sx;
  2109.     XbWVMs_YPos = *XbWVWd_W.ny+*XbWVWd_W.sy;
  2110.     XbWSMs_Warp(XbWVMs_XPos, XbWVMs_YPos);
  2111.     XbWSMs_SetHandCursor();
  2112.     if (XQueryPointer(
  2113.           XbWVSy_ConTxt.dpy,
  2114.           XbWVSy_ConTxt.window,
  2115.           &root, &child,
  2116.           &xr, &yr, &xp, &yp, &mask)==True){
  2117.       SizeXneu = xp;
  2118.       SizeYneu = yp;
  2119.       XbWSMs_FramON(*XbWVWd_W.nx,*XbWVWd_W.ny,SizeXneu,SizeYneu,14);
  2120.       while (!ende){
  2121.         if (XQueryPointer(
  2122.             XbWVSy_ConTxt.dpy,
  2123.             XbWVSy_ConTxt.window,
  2124.             &root, &child,
  2125.             &xr, &yr, &xp, &yp, &mask)==True){
  2126.           if (mask & Button1Mask){
  2127.             XbWSMs_FramOFF(*XbWVWd_W.nx,*XbWVWd_W.ny,SizeXneu,SizeYneu);
  2128.             SizeXneu = xp;
  2129.             SizeYneu = yp;
  2130.             XbWSMs_FramON(*XbWVWd_W.nx,*XbWVWd_W.ny,SizeXneu,SizeYneu,14);
  2131.             }
  2132.           else {
  2133.             ende=1;
  2134.             };
  2135.           };
  2136.         };
  2137.       };
  2138.  
  2139.     XbWSMs_FramOFF(*XbWVWd_W.nx,*XbWVWd_W.ny,SizeXneu,SizeYneu);
  2140.     XbWSMs_SetArrowCursor();
  2141.     XbWFWd_EraWdw();
  2142.     if (SizeXneu < 0) { SizeXneu = 0;};
  2143.     if (SizeXneu > XbWFGr_MaxX()) { SizeXneu = XbWFGr_MaxX()-20;};
  2144.     if (SizeYneu < 0) { SizeYneu = 0;  };
  2145.     if (SizeYneu > XbWFGr_MaxY()) { SizeYneu = XbWFGr_MaxY()-40;};
  2146.  
  2147.     *XbWVWd_W.sx = SizeXneu-*XbWVWd_W.nx;
  2148.     *XbWVWd_W.sy = SizeYneu-*XbWVWd_W.ny;
  2149.     XbWFWd_DrawAll();
  2150.     };
  2151. #endif
  2152.   XbWFWd_DrawAll();
  2153.   if (p == NULL){
  2154.     XbWFWd_DrawAll();
  2155.     }
  2156.   else {
  2157.     if ((int)(*p)[0] > 0) {
  2158.       if ((int)(*p)[1] > 0) {
  2159.         XbWFWd_DrawAll();
  2160.         };
  2161.       }
  2162.     else {
  2163.       XbWFWd_DrawAll();
  2164.       };
  2165.     };
  2166.   XbWFGr_CurON();
  2167.   };
  2168. /*}}}  */
  2169. /*{{{  XbWSWd_Move(        TC3,GNU,X!!    Aktuelles Fenster bewegen*/
  2170. void  XbWSWd_Move(void){
  2171.   int NullXneu,NullYneu,Mausx,Mausy;
  2172.   NullXneu = *XbWVWd_W.nx; NullYneu = *XbWVWd_W.ny;
  2173.   Mausx = XbWVMs_XPos; Mausy = XbWVMs_YPos;
  2174.   XbWFGr_MaxPort();
  2175. #ifdef XbW_SYSDEF_TC3_VERSION
  2176.   XbWSMs_FramON(*XbWVWd_W.nx,*XbWVWd_W.ny,*XbWVWd_W.nx+*XbWVWd_W.sx,*XbWVWd_W.ny+*XbWVWd_W.sy,14);
  2177.   while (XbWVMs_Button == 1){
  2178.     Mausx = XbWVMs_XPos; Mausy = XbWVMs_YPos;
  2179.     XbWSMs_Stat(); XbWSMs_ChkMot();
  2180.     if (XbWVMs_Bewegt == 1){
  2181.       XbWSMs_DFramOFF(NullXneu,NullYneu,NullXneu+*XbWVWd_W.sx,NullYneu+*XbWVWd_W.sy);
  2182.       Mausx = XbWVMs_XPos-Mausx;Mausy = XbWVMs_YPos-Mausy;
  2183.  
  2184.       NullXneu = NullXneu + Mausx; NullYneu = NullYneu +Mausy;
  2185.       XbWVMs_CX = XbWVMs_XPos; XbWVMs_CY = XbWVMs_YPos;
  2186.       XbWSMs_FramON(NullXneu,NullYneu,NullXneu+*XbWVWd_W.sx,NullYneu+*XbWVWd_W.sy,14);
  2187.       };
  2188.     };
  2189.   XbWSMs_DFramOFF(NullXneu,NullYneu,NullXneu+*XbWVWd_W.sx,NullYneu+*XbWVWd_W.sy);
  2190. #endif
  2191. #ifdef XbW_SYSDEF_GNU_VERSION
  2192.   {
  2193.     int ende = 0;
  2194.     MouseEvent mev;
  2195.     MouseWarp(NullXneu+3,NullYneu+2);
  2196.     XbWSMs_SetHandCursor();
  2197.     MouseSetCursorMode(M_CUR_BOX,-3,-2,*XbWVWd_W.sx-3,*XbWVWd_W.sy-2,15);
  2198.     MouseGetEvent(M_BUTTON_UP, &mev);
  2199.     NullXneu = mev.x-3;
  2200.     NullYneu = mev.y-2;
  2201.     XbWSMs_SetArrowCursor();
  2202.     MouseSetCursorMode(M_CUR_NORMAL);
  2203.     MouseWarp(Mausx,Mausy);
  2204.     };
  2205. #endif
  2206. #ifdef XbW_SYSDEF_X11_VERSION
  2207.   {
  2208.     int ende = 0;
  2209.     Window root, child;
  2210.     int xr, yr, xp, yp;
  2211.     unsigned int mask;
  2212.  
  2213.     XbWVMs_XPos = *XbWVWd_W.nx;
  2214.     XbWVMs_YPos = *XbWVWd_W.ny;
  2215.     XbWSMs_Warp(XbWVMs_XPos, XbWVMs_YPos);
  2216.     Mausx = XbWVMs_XPos; Mausy = XbWVMs_YPos;
  2217.     XbWSMs_SetHandCursor();
  2218.     if (XQueryPointer(
  2219.           XbWVSy_ConTxt.dpy,
  2220.           XbWVSy_ConTxt.window,
  2221.           &root, &child,
  2222.           &xr, &yr, &xp, &yp, &mask)==True){
  2223.       NullXneu = xp;
  2224.       NullYneu = yp;
  2225.       XbWSMs_FramON(NullXneu,NullYneu,NullXneu+*XbWVWd_W.sx,NullYneu+*XbWVWd_W.sy,14);
  2226.       while (!ende){
  2227.         if (XQueryPointer(
  2228.             XbWVSy_ConTxt.dpy,
  2229.             XbWVSy_ConTxt.window,
  2230.             &root, &child,
  2231.             &xr, &yr, &xp, &yp, &mask)==True){
  2232.           if (mask & Button1Mask){
  2233.             XbWSMs_FramOFF(NullXneu,NullYneu,NullXneu+*XbWVWd_W.sx,NullYneu+*XbWVWd_W.sy);
  2234.             NullXneu = xp;
  2235.             NullYneu = yp;
  2236.             XbWSMs_FramON(NullXneu,NullYneu,NullXneu+*XbWVWd_W.sx,NullYneu+*XbWVWd_W.sy,8);
  2237.             }
  2238.           else {
  2239.             ende=1;
  2240.             };
  2241.           };
  2242.         };
  2243.       };
  2244.  
  2245.     XbWSMs_FramOFF(NullXneu,NullYneu,NullXneu+*XbWVWd_W.sx,NullYneu+*XbWVWd_W.sy);
  2246.     XbWSMs_SetArrowCursor();
  2247.     };
  2248. #endif
  2249.   XbWFWd_EraWdw();
  2250.   if (NullXneu < 0) { NullXneu = 0;};
  2251.   if (NullXneu > XbWFGr_MaxX()) { NullXneu = XbWFGr_MaxX()-20;};
  2252.   if (NullYneu < 0) { NullYneu = 0;  };
  2253.   if (NullYneu > XbWFGr_MaxY()) { NullYneu = XbWFGr_MaxY()-40;};
  2254.  
  2255.   *XbWVWd_W.nx = NullXneu;
  2256.   *XbWVWd_W.ny = NullYneu;
  2257.   XbWFWd_DrawAll();
  2258.   };
  2259. /*}}}  */
  2260. /*}}}  */
  2261. /*{{{  XbWSGr_XXXXXXX(     TC3,GNU,x--    Grafikfunktionen/Modi*/
  2262. /*{{{  XbWSGr_ResMode(     TC3,GNU,x--    Grafikmodus wiederherstellen*/
  2263. void  XbWSGr_ResMode(void){
  2264. #ifdef XbW_SYSDEF_TC3_VERSION
  2265.   int GT = XbWDGr_AkDrivr;
  2266.   int GM = XbWDGr_AkGrMod;
  2267.   initgraph((int far *)>,(int far *)&GM,"\\xw\\bgi");
  2268.   if ((GT=graphresult()) != grOk) {
  2269.     printf("VGA Graphic Error: %s\n",
  2270.     grapherrormsg(GT));
  2271.     exit(1);
  2272.     };
  2273. #endif
  2274. #ifdef XbW_SYSDEF_GNU_VERSION
  2275.   if ((XbWVSy_ConTxt.top.txo_font = GrLoadFont("pc8x8.fnt")) == NULL) {return;};
  2276.   XbWVSy_ConTxt.top.txo_xmag = 1;
  2277.   XbWVSy_ConTxt.top.txo_ymag = 1;
  2278.   XbWVSy_ConTxt.top.txo_direct = GR_TEXT_RIGHT;
  2279.   XbWVSy_ConTxt.top.txo_xalign = GR_ALIGN_LEFT;
  2280.   XbWVSy_ConTxt.top.txo_yalign = GR_ALIGN_TOP;
  2281.   XbWVSy_ConTxt.top.txo_chrtype = GR_BYTE_TEXT;
  2282.   XbWSMs_Init();
  2283. #endif
  2284.   };
  2285. /*}}}  */
  2286. /*{{{  XbWSGr_Close(       TC3,g--,x--    Grafik schließen*/
  2287. void   XbWSGr_Close(void){
  2288. #ifdef XbW_SYSDEF_TC3_VERSION
  2289.   closegraph();
  2290.   textmode(C80);
  2291.   textcolor(WHITE);
  2292.   textbackground(BLACK);
  2293.   clrscr();
  2294. #endif
  2295.   };
  2296. /*}}}  */
  2297. /*{{{  XbWSGr_GtPhysX(     TC3,GNU,X11    Grosste Schirmkoordinate X*/
  2298. int  XbWSGr_GtPhysX(void){
  2299. #ifdef XbW_SYSDEF_TC3_VERSION
  2300.   return(getmaxx());
  2301. #endif
  2302. #ifdef XbW_SYSDEF_GNU_VERSION
  2303.   return(GrMaxX()-1);
  2304. #endif
  2305. #ifdef XbW_SYSDEF_X11_VERSION
  2306.   return(XbW_X11_ScreenWidth);
  2307. #endif
  2308.   };
  2309. /*}}}  */
  2310. /*{{{  XbWSGr_GtPhysY(     TC3,GNU,X11           -"-               Y*/
  2311. int  XbWSGr_GtPhysY(void){
  2312. #ifdef XbW_SYSDEF_TC3_VERSION
  2313.   return(getmaxy());
  2314. #endif
  2315. #ifdef XbW_SYSDEF_GNU_VERSION
  2316.   return(GrMaxY()-1);
  2317. #endif
  2318. #ifdef XbW_SYSDEF_X11_VERSION
  2319.   return(XbW_X11_ScreenHeight);
  2320. #endif
  2321.   };
  2322. /*}}}  */
  2323. /*{{{  XbWSGr_DspIcon(     TC3,g!!,x!!    Icon darstellen*/
  2324. void  XbWSGr_DspIcon(
  2325.     XbWDDb_DbIObj  *TO){
  2326. #ifdef XbW_SYSDEF_TC3_VERSION
  2327.   FILE *fp;
  2328.   char *fname;
  2329.   char pict[1600];
  2330.   fname = (char*)XbWFDb_VarInh(TO->chn,XbWDDb_Str,"V",1);
  2331.   if (fname != NULL) {
  2332.     if ((fp = XbWSSy_fopen(fname,"rb")) != NULL) {
  2333.       fseek(fp,68,SEEK_SET);
  2334.       fread(pict,1,1599,fp);
  2335.       putimage(*TO->XA+1, *TO->YA+1,pict,COPY_PUT);
  2336.       fclose(fp);
  2337.       };
  2338.     };
  2339. #endif
  2340.   };
  2341. /*}}}  */
  2342. /*{{{  XbWSGr_GtImSiz(     TC3,g--,x--    Turbo C-Funktion*/
  2343. unsigned  XbWSGr_GtImSiz(int a, int b, int c, int d){
  2344. #ifdef XbW_SYSDEF_TC3_VERSION
  2345.   return(imagesize(a,b,c,d));
  2346. #endif
  2347.   return(1);
  2348.   };
  2349. /*}}}  */
  2350. /*{{{  XbWSGr_PutImag(     TC3,g--,x--    Turbo C-Funktion*/
  2351. void  XbWSGr_PutImag(int a, int b, void  *c, int d){
  2352. #ifdef XbW_SYSDEF_TC3_VERSION
  2353.   putimage(a,b,c,d);
  2354. #endif
  2355.   };
  2356. /*}}}  */
  2357. /*{{{  XbWSGr_GetImag(     TC3,g--,x--    Turbo C-Funktion*/
  2358. void  XbWSGr_GetImag(int a, int b, int c, int d, void  *e){
  2359. #ifdef XbW_SYSDEF_TC3_VERSION
  2360.   getimage(a,b,c,d,e);
  2361. #endif
  2362.   };
  2363. /*}}}  */
  2364. /*{{{  XbWSGr_SetClip(     TC3,GNU,X11    Clipping für Zeichenfunkt.*/
  2365. void  XbWSGr_SetClip(
  2366.     int xa, int ya, int xb, int yb){
  2367. #ifdef XbW_SYSDEF_TC3_VERSION
  2368.   setviewport(xa,ya,xb,yb,1);
  2369. #endif
  2370. #ifdef XbW_SYSDEF_GNU_VERSION
  2371.   XbWVSy_ConTxt.XA = xa;
  2372.   XbWVSy_ConTxt.YA = ya;
  2373.   XbWVSy_ConTxt.XB = xb;
  2374.   XbWVSy_ConTxt.YB = yb;
  2375.   GrSetClipBox(XbWVSy_ConTxt.XA,XbWVSy_ConTxt.YA,XbWVSy_ConTxt.XB,XbWVSy_ConTxt.YB);
  2376. #endif
  2377. #ifdef XbW_SYSDEF_X11_VERSION
  2378.   {
  2379.     XRectangle rect[1];
  2380.     int hh;
  2381.     if (xa > xb) {
  2382.       hh = xa; xa = xb; xb = hh;
  2383.       };
  2384.     if (ya > yb) {
  2385.       hh = ya; ya = yb; yb = hh;
  2386.       };
  2387.     rect[0].x = xa-1;        rect[0].y = ya-1;
  2388.     rect[0].width = xb-xa+2; rect[0].height = yb-ya+2;
  2389.     XbWVSy_ConTxt.XA = xa;
  2390.     XbWVSy_ConTxt.YA = ya;
  2391.     XbWVSy_ConTxt.XB = xb;
  2392.     XbWVSy_ConTxt.YB = yb;
  2393.  
  2394.     XSetClipRectangles(
  2395.       XbWVSy_ConTxt.dpy,
  2396.       XbWVSy_ConTxt.gc,
  2397.       0,
  2398.       0,
  2399.       rect,
  2400.       1,
  2401.       Unsorted);
  2402.  
  2403.     };
  2404. #endif
  2405.   };
  2406. /*}}}  */
  2407. /*{{{  XbWSGr_GetClip(     TC3,GNU,X11    Clipping für Zeichenfunkt.*/
  2408. void  XbWSGr_GetClip(void  *theport){
  2409. #ifdef XbW_SYSDEF_TC3_VERSION
  2410.   getviewsettings((struct viewporttype far *)theport);
  2411. #endif
  2412. #ifdef XbW_SYSDEF_GNU_VERSION
  2413.   int a,b,c,d;
  2414.   struct viewporttype far *t = (struct viewporttype far *)theport;
  2415.   t->left   = XbWVSy_ConTxt.XA;
  2416.   t->top    = XbWVSy_ConTxt.YA;
  2417.   t->right  = XbWVSy_ConTxt.XB;
  2418.   t->bottom = XbWVSy_ConTxt.YB;
  2419.   t->clip = 1;
  2420. #endif
  2421. #ifdef XbW_SYSDEF_X11_VERSION
  2422.  
  2423.   struct viewporttype far *t = (struct viewporttype far *)theport;
  2424.   t->left   = XbWVSy_ConTxt.XA;
  2425.   t->top    = XbWVSy_ConTxt.YA;
  2426.   t->right  = XbWVSy_ConTxt.XB;
  2427.   t->bottom = XbWVSy_ConTxt.YB;
  2428.   t->clip = 1;
  2429. #endif
  2430.   };
  2431. /*}}}  */
  2432. /*}}}  */
  2433. /*{{{  XbWSGr_SetFontLib(  TC3,g--,x--    Font Parameter aufsetzen*/
  2434. int  XbWSGr_SetFontLib(void){
  2435. #ifdef XbW_SYSDEF_TC3_VERSION
  2436.   setusercharsize(1,1,1,1);
  2437. #endif
  2438.   return(0);
  2439.   };
  2440. /*}}}  */
  2441. /*{{{  XbWSOS_FilDir(      TC3,g!!,x!!    String-Array mit Dateinamen*/
  2442. int  XbWSOS_FilDir(void  *(*p)[]){
  2443. #ifdef XbW_SYSDEF_TC3_VERSION
  2444.   int ii,atrb,firstfound;
  2445.   struct ffblk erg;
  2446.   char suchname[60],sstr[60],*strp;
  2447.   FILE *fp;
  2448.   XbWDDb_Header th;
  2449.   XbWDDb_DbIVar  *ac_gp;
  2450.   /* Parameterliste
  2451.      =======================================================
  2452.      1 - Listenname (z.B. OBJ)
  2453.      2 - Gruppenname (z.B. oszill)
  2454.      3 - Variablenname (chain) ohne chain-Nr
  2455.          (BSP: fp fuer alle fp0...fp13)
  2456.      4 - Drive auf dem gesucht wird
  2457.      5 - Subdirectory in dem gesucht wird
  2458.      6 - Suchmodus:
  2459.          'A' - finde archivierte Dateien
  2460.          'D' - finde Directories
  2461.          'S' - finde Systemdateien
  2462.          'P' - finde XbW-Projekte
  2463.      7 - Anzeigespezifikation
  2464.          'P' - mit Pfad
  2465.          'E' - mit Extension
  2466.      8 - Startnummer zum Fuellen (ausgelassene Eintraege)
  2467.      9 - Suchspezifikation
  2468.   [  10 - Variable fuer Datei-Beschreibungen (selbe Liste & Gruppe)
  2469.      11 - Variable fuer Datei-Laengen          ] (optionale Param.)
  2470.      ======================================================= */
  2471.   switch ( (int)(*p)[0] ) {
  2472.     case 9:
  2473.     case 11: break;
  2474.     default: return(1);
  2475.     };
  2476.   atrb = 0;
  2477.   if (strchr((char*)(*p)[6],'A') != NULL) { atrb |= FA_ARCH; };
  2478.   if (strchr((char*)(*p)[6],'D') != NULL) { atrb |= FA_DIREC; };
  2479.   if (strchr((char*)(*p)[6],'S') != NULL) { atrb |= FA_SYSTEM; };
  2480.   firstfound = 0;
  2481.   sprintf(suchname,"%s%s\\%s",(char*)(*p)[4],(char*)(*p)[5],(char*)(*p)[9]);
  2482.   for (ii=0; ii< (int)(*p)[8]; ii++){
  2483.     if (!ii){
  2484.       if (findfirst(suchname,&erg,atrb)){ return(0);};
  2485.       firstfound = 1;
  2486.       }
  2487.     else {
  2488.       if (findnext(&erg) ){ return(0);};
  2489.       };
  2490.     };
  2491.   if ((ac_gp = XbWFDb_FindGrp((char*)(*p)[1],(char*)(*p)[2])) == NULL) {
  2492.     return(0);
  2493.     };
  2494.   for (ii=0; ii< 2000; ii++){
  2495.     sprintf(sstr,"%s%d",(char*)(*p)[3],ii);
  2496.     if ((strp = (char*)XbWFDb_VarInh(ac_gp,XbWDDb_Str,sstr,1)) == NULL) {
  2497.       ii = 3000;
  2498.       }
  2499.     else {
  2500.       strcpy(strp,"");
  2501.       sprintf(sstr,"%s%d",(char*)(*p)[10],ii);
  2502.       if (!XbWFDb_PutStr(ac_gp,sstr,1," ")) {
  2503.         }
  2504.       else {
  2505.         sprintf(sstr,"%s%d",(char*)(*p)[11],ii);
  2506.         XbWFDb_PutNum(ac_gp,sstr,1,0);
  2507.         };
  2508.       };
  2509.     };
  2510.   for (ii=0; ii< 2000; ii++){
  2511.     if ((!ii)&(!firstfound)){
  2512.       if (findfirst(suchname,&erg,atrb)){ return(0);};
  2513.       firstfound = 1;
  2514.       }
  2515.     else {
  2516.       if (findnext(&erg) ){ return(0);};
  2517.       };
  2518.     sprintf(sstr,"%s%d",(char*)(*p)[3],ii);
  2519.     if ((strp = (char*)XbWFDb_VarInh(ac_gp,XbWDDb_Str,sstr,1)) == NULL) {
  2520.       return(0);
  2521.       };
  2522.     if (strchr((char*)(*p)[7],'P') != NULL) {
  2523.       strcpy(strp,(char*)(*p)[4]);
  2524.       strcat(strp,(char*)(*p)[5]);
  2525.       }
  2526.     else {
  2527.       strcpy(strp,"");
  2528.       };
  2529.     if (strchr((char*)(*p)[7],'E') != NULL) {
  2530.       strcat(strp,erg.ff_name);
  2531.       }
  2532.     else {
  2533.       if (strchr(erg.ff_name,'.') != NULL) {
  2534.         strcpy(strchr(erg.ff_name,'.'),"\0");
  2535.         };
  2536.       strcat(strp,erg.ff_name);
  2537.       };
  2538.     if (strchr((char*)(*p)[6],'P') != NULL) {
  2539.       if (strchr((char*)(*p)[7],'E') != NULL) {
  2540.         sprintf(sstr,"%s%s\\%s",(char*)(*p)[4],(char*)(*p)[5],erg.ff_name);
  2541.         }
  2542.       else {
  2543.         sprintf(sstr,"%s%s\\%s.prj",(char*)(*p)[4],(char*)(*p)[5],erg.ff_name);
  2544.         };
  2545.       if ((fp = XbWSSy_fopen(sstr,"rb") ) != NULL){
  2546.         fread(&th,sizeof(XbWDDb_Header),1,fp);
  2547.         fclose(fp);
  2548.         sprintf(sstr,"%s%d",(char*)(*p)[10],ii);
  2549.         if (!XbWFDb_PutStr(ac_gp,sstr,1,th.reserviert)) {
  2550.           return(0);
  2551.           };
  2552.         sprintf(sstr,"%s%d",(char*)(*p)[11],ii);
  2553.         XbWFDb_PutNum(ac_gp,sstr,1,(double)((th.tab_size/1000)+1));
  2554.         };
  2555.       };
  2556.     };
  2557. #endif
  2558.   return(0);
  2559.   };
  2560. /*}}}  */
  2561. /*{{{  XbWSOS_SpwnShel(    TC3,g!!,x!!    OS-Shell spawn*/
  2562. void  XbWSOS_SpwnShel(void){
  2563. #ifdef XbW_SYSDEF_TC3_VERSION
  2564.   int curdrive; char curpath[70];curdrive = getdisk();
  2565.   getcurdir(0,curpath);
  2566.   XbWSGr_Close();
  2567.   if (system("c:\\command.com c:\\") != 0) {
  2568.     puts("Cannot spawn system task ");
  2569.     exit(0);};
  2570.   setdisk(curdrive);chdir(curpath);
  2571. #endif
  2572. #ifdef XbW_SYSDEF_X11_VERSION
  2573.   if (system("xterm") != 0) {
  2574.     puts("Cannot spawn system task ");
  2575.     exit(0);};
  2576. #endif
  2577.   XbWSGr_ResMode(); XbWFWd_BackGr();
  2578.   XbWFWd_DrawAll();
  2579.   };
  2580. /*}}}  */
  2581. /*{{{  XbWSOS_SpwnStd(     TC3,g!!,x!!    Standard-Task spawnen*/
  2582. int  XbWSOS_SpwnStd(void  *(*p)[], int (*t)[]){
  2583. /*{{{  TC3-Version*/
  2584. #ifdef XbW_SYSDEF_TC3_VERSION
  2585.   int curdrive; char curpath[70];
  2586.   curdrive = getdisk();
  2587.   getcurdir(0,curpath);
  2588.   if ((int)(*p)[0] < 1 ) {return(1);};
  2589.   switch ( (int)(*t)[1] ) {
  2590.     case XbWDMf_StrPar:
  2591.       strcpy(XbWVSy_DosCmd,(char*)(*p)[1]);
  2592.       break;
  2593.     case XbWDMf_VLPar:
  2594.       {
  2595.         XbWDDb_DbIVar  *QQ;
  2596.         char *fsp;
  2597.         QQ = (XbWDDb_DbIVar  *)(*p)[1];
  2598.         if (QQ == NULL) { return(1); };
  2599.         fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1);
  2600.         strcpy(XbWVSy_DosCmd,(char*)XbWFTb_PckTxt(fsp));
  2601.         };
  2602.       break;
  2603.     default: return(1);
  2604.     };
  2605.  
  2606.   {
  2607.     int ll = 2;
  2608.     while ((int)(*p)[0] >= ll) {
  2609.       switch ( (int)(*t)[ll] ) {
  2610.         case XbWDMf_IntPar:
  2611.         case XbWDMf_VPPar:
  2612.           {
  2613.             char zzs[30];
  2614.             sprintf(zzs,"%d ",(int)(*p)[ll]);
  2615.             strcat(XbWVSy_DosCmd,zzs);
  2616.             goto SpawnWeiter;
  2617.             };
  2618.  
  2619.         case XbWDMf_DblPar:
  2620.         case XbWDMf_StrPar:
  2621.           strcat(XbWVSy_DosCmd,(char*)(*p)[ll]);
  2622.           strcat(XbWVSy_DosCmd," ");
  2623.           break;
  2624.         case XbWDMf_VLPar:
  2625.           {
  2626.             XbWDDb_DbIVar  *QQ;
  2627.             char *fsp; double zz; int zi;
  2628.             QQ = (XbWDDb_DbIVar  *)(*p)[ll];
  2629.             if (QQ == NULL) { return(1); };
  2630.             if ((fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1)) != NULL) {
  2631.               strcat(XbWVSy_DosCmd,(char*)XbWFTb_PckTxt(fsp));
  2632.               strcat(XbWVSy_DosCmd," ");
  2633.               goto SpawnWeiter;
  2634.               };
  2635.             if ((fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Int,NULL,1)) != NULL) {
  2636.               zi = XbWFDb_GetNum(QQ,NULL,1);
  2637.               {
  2638.                 char zzs[200];
  2639.                 sprintf(zzs,"%d ",zi);
  2640.                 strcat(XbWVSy_DosCmd,zzs);
  2641.                 goto SpawnWeiter;
  2642.                 };
  2643.               };
  2644.             if ((fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Dbl,NULL,1)) != NULL) {
  2645.               zz = XbWFDb_GetNum(QQ,NULL,1);
  2646.               {
  2647.                 char zzs[200];
  2648.                 sprintf(zzs,"%7.3f ",zz);
  2649.                 strcat(XbWVSy_DosCmd,zzs);
  2650.                 goto SpawnWeiter;
  2651.                 };
  2652.               };
  2653.             };
  2654.           break;
  2655.         };
  2656.       SpawnWeiter:;
  2657.       ll++;
  2658.       };
  2659.     };
  2660.   XbWFTb_SpwnTsk();
  2661.   setdisk(curdrive);chdir(curpath);
  2662.   XbWSGr_GotoXY(1,1);
  2663. #endif
  2664. /*}}}  */
  2665. /*{{{  X11-Version*/
  2666. #ifdef XbW_SYSDEF_X11_VERSION
  2667.   if ((int)(*p)[0] < 1 ) {return(1);};
  2668.   switch ( (int)(*t)[1] ) {
  2669.     case XbWDMf_StrPar:
  2670.       strcpy(XbWVSy_DosCmd,(char*)(*p)[1]);
  2671.         strcpy(XbWVSy_DosCmd,(char*)XbWFTb_PckTxt(XbWVSy_DosCmd));
  2672.       break;
  2673.     case XbWDMf_VLPar:
  2674.       {
  2675.         XbWDDb_DbIVar  *QQ;
  2676.         char *fsp;
  2677.         QQ = (XbWDDb_DbIVar  *)(*p)[1];
  2678.         if (QQ == NULL) { return(1); };
  2679.         fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1);
  2680.         strcpy(XbWVSy_DosCmd,(char*)XbWFTb_PckTxt(fsp));
  2681.         };
  2682.       break;
  2683.     default: return(1);
  2684.     };
  2685.  
  2686.   {
  2687.     int ll = 2;
  2688.     while ((int)(*p)[0] >= ll) {
  2689.       switch ( (int)(*t)[ll] ) {
  2690.         case XbWDMf_IntPar:
  2691.         case XbWDMf_VPPar:
  2692.           {
  2693.             char zzs[30];
  2694.             sprintf(zzs,"%d ",(int)(*p)[ll]);
  2695.             strcat(XbWVSy_DosCmd,zzs);
  2696.             goto SpawnWeiter;
  2697.             };
  2698.  
  2699.         case XbWDMf_DblPar:
  2700.         case XbWDMf_StrPar:
  2701.             {
  2702.               char SsTr[200];
  2703.               sprintf(SsTr,(char*)(*p)[ll]);
  2704.               if (strstr(SsTr,"/")!= NULL){
  2705.                 int ii;
  2706.                 for (ii=0;ii<strlen(SsTr);ii++){
  2707.                   if (SsTr[ii] == '\\'){
  2708.                     SsTr[ii] = '/';
  2709.                     }
  2710.                   else {
  2711.                     if ((SsTr[ii] >= 'A') & (SsTr[ii] <= 'Z')){
  2712.                       SsTr[ii] = tolower(SsTr[ii]);
  2713.                       };
  2714.                     };
  2715.                   };
  2716.                 strcat(XbWVSy_DosCmd,SsTr);
  2717.                 }
  2718.               else {
  2719.                 strcat(XbWVSy_DosCmd,(char*)(*p)[ll]);
  2720.                 };
  2721.               };
  2722.             strcat(XbWVSy_DosCmd," ");
  2723.           break;
  2724.         case XbWDMf_VLPar:
  2725.           {
  2726.             XbWDDb_DbIVar  *QQ;
  2727.             char *fsp; double zz; int zi;
  2728.             QQ = (XbWDDb_DbIVar  *)(*p)[ll];
  2729.             if (QQ == NULL) { return(1); };
  2730.             if ((fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1)) != NULL) {
  2731.               char SsTr[200];
  2732.               sprintf(SsTr,fsp);
  2733.               if (strstr(SsTr,"/")!= NULL){
  2734.                 int ii;
  2735.                 for (ii=0;ii<strlen(SsTr);ii++){
  2736.                   if (SsTr[ii] == '\\'){
  2737.                     SsTr[ii] = '/';
  2738.                     }
  2739.                   else {
  2740.                     if ((SsTr[ii] >= 'A') & (SsTr[ii] <= 'Z')){
  2741.                       SsTr[ii] = tolower(SsTr[ii]);
  2742.                       };
  2743.                     };
  2744.                   };
  2745.                 strcat(XbWVSy_DosCmd,(char*)XbWFTb_PckTxt(SsTr));
  2746.                 }
  2747.               else {
  2748.                 strcat(XbWVSy_DosCmd,(char*)XbWFTb_PckTxt(fsp));
  2749.                 };
  2750.               strcat(XbWVSy_DosCmd," ");
  2751.               goto SpawnWeiter;
  2752.               };
  2753.             if ((fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Int,NULL,1)) != NULL) {
  2754.               zi = XbWFDb_GetNum(QQ,NULL,1);
  2755.               {
  2756.                 char zzs[200];
  2757.                 sprintf(zzs,"%d ",zi);
  2758.                 strcat(XbWVSy_DosCmd,zzs);
  2759.                 goto SpawnWeiter;
  2760.                 };
  2761.               };
  2762.             if ((fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Dbl,NULL,1)) != NULL) {
  2763.               zz = XbWFDb_GetNum(QQ,NULL,1);
  2764.               {
  2765.                 char zzs[200];
  2766.                 sprintf(zzs,"%7.3f ",zz);
  2767.                 strcat(XbWVSy_DosCmd,zzs);
  2768.                 goto SpawnWeiter;
  2769.                 };
  2770.               };
  2771.             };
  2772.           break;
  2773.         };
  2774.       SpawnWeiter:;
  2775.       ll++;
  2776.       };
  2777.     };
  2778.   printf("spawning task \"%s\"\n",XbWVSy_DosCmd);
  2779.   system(XbWVSy_DosCmd);
  2780.   return(0);
  2781. #endif
  2782. /*}}}  */
  2783.   return(0);
  2784.   };
  2785.  
  2786. /*}}}  */
  2787. /*{{{  XbWSOS_XXXXX(       TC3,GNU,x!!    Sound / Delay*/
  2788. /*{{{  XbWSOS_Sound(       TC3,GNU,x!!    Ton in Hertz ausgeben*/
  2789. void  XbWSOS_Sound(int freq){
  2790. #ifdef XbW_SYSDEF_TC3_VERSION
  2791.   sound(freq);
  2792. #endif
  2793. #ifdef XbW_SYSDEF_GNU_VERSION
  2794.   sound(freq);
  2795. #endif
  2796.   };
  2797. /*}}}  */
  2798. /*{{{  XbWSOS_NoSound(     TC3,GNU,x!!    Ton Aus*/
  2799. void  XbWSOS_NoSound(void){
  2800. #ifdef XbW_SYSDEF_TC3_VERSION
  2801.   nosound();
  2802. #endif
  2803. #ifdef XbW_SYSDEF_GNU_VERSION
  2804.   nosound();
  2805. #endif
  2806.   };
  2807. /*}}}  */
  2808. /*{{{  XbWSOS_Delay(       TC3,GNU,x!!    XbWFTb_Wait in Millisekunden*/
  2809. void  XbWSOS_Delay(int len){
  2810. #ifdef XbW_SYSDEF_TC3_VERSION
  2811.   delay(len);
  2812. #endif
  2813.  
  2814. #ifdef XbW_SYSDEF_GNU_VERSION
  2815.   long l=0;
  2816.   while(l < XbWVSy_DlyLim*len){
  2817.     l++;
  2818.     };
  2819. #endif
  2820.   };
  2821. /*}}}  */
  2822. /*}}}  */
  2823. /*{{{  XbWSSy_XXXTime(     TC3,g??,x??    Zeit / Datum*/
  2824. /*{{{  XbWSSy_GetTime(     TC3,g??,x??    Systemzeit*/
  2825. void   XbWSSy_GetTime(unsigned char *hh,unsigned char *mm,
  2826.                    unsigned char *ss,unsigned char *hhh){
  2827. #ifdef XbW_SYSDEF_TC3_VERSION
  2828.   struct time mytime;
  2829.   gettime(&mytime);
  2830.   *hh = mytime.ti_hour;
  2831.   *mm=mytime.ti_min;
  2832.   *ss=mytime.ti_sec;
  2833.   *hhh= mytime.ti_hund;
  2834. #endif
  2835.   };
  2836. /*}}}  */
  2837. /*{{{  XbWSSy_GetDate(     TC3,g??,x??    Systemdatum*/
  2838. void   XbWSSy_GetDate(unsigned char *yy,unsigned char *mm,
  2839.                    unsigned char *dd){
  2840. #ifdef XbW_SYSDEF_TC3_VERSION
  2841.   struct date mydate;
  2842.   getdate(&mydate);
  2843.   *yy = mydate.da_year;
  2844.   *mm = mydate.da_mon;
  2845.   *dd = mydate.da_day;
  2846. #endif
  2847.   };
  2848. /*}}}  */
  2849. /*{{{  XbWSSy_TimeSec(     TC3,GNU,X11    Sekunden seit 1.1.1980*/
  2850. time_t   XbWSSy_TimeSec(void){
  2851. #ifdef XbW_SYSDEF_TC3_VERSION
  2852.   return(time(NULL));
  2853. #endif
  2854. #ifdef XbW_SYSDEF_GNU_VERSION
  2855.   return(time(NULL));
  2856. #endif
  2857. #ifdef XbW_SYSDEF_X11_VERSION
  2858.   return(time(NULL));
  2859. #endif
  2860.   };
  2861. /*}}}  */
  2862. /*}}}  */
  2863. /*{{{  XbWSPu_XXXXX(       TC3,g??,x??    Pop-Up-Funktionen*/
  2864. /*{{{  XbWSPu_Error(       TC3,g??,x??    Fehler ausgeben, System beenden*/
  2865. void   XbWSPu_Error(char text[255]){
  2866. #ifdef XbW_SYSDEF_TC3_VERSION
  2867.   textmode(C80);
  2868.   textcolor(XbWVGr_Red);textbackground(XbWVGr_White);
  2869.   clrscr(); gotoxy(10,10);
  2870.   printf("A fatal error has occured.");
  2871.   gotoxy(10,12); printf(text); exit(1);
  2872. #endif
  2873. #ifdef XbW_SYSDEF_X11_VERSION
  2874.   printf("\n* * * A fatal error has occurred:\n%s\n",text);
  2875.   printf("* * * Last command prepared: %s\nXbW command line buffer: %s\n\n",
  2876.      XbWVSy_DebugCommand,XbWVSy_DebugLine);
  2877.   if (XbWVMf_C >= 0){
  2878.      printf("Last command parameter prepared: no %d\n",XbWVMf_C);
  2879.      switch(XbWVMf_T[XbWVMf_C-1]) {
  2880.        case XbWDMf_StrPar:
  2881.             printf("* * * STRING PARAMETER \"%s\"\n",&(XbWVMf_B[(XbWVMf_C)*XbWDMf_BfStrL]));
  2882.             break;
  2883.        case XbWDMf_DblPar:
  2884.             printf("* * * DOUBLE PARAMETER \"%s\"\n",&(XbWVMf_B[(XbWVMf_C)*XbWDMf_BfStrL]));
  2885.             break;
  2886.        case XbWDMf_IntPar:
  2887.        case XbWDMf_VPPar:
  2888.             printf("* * * INT PARAMETER \"%d\"\n",(int)XbWVMf_P[XbWVMf_C]);
  2889.             break;
  2890.        case XbWDMf_VLPar:
  2891.             printf("* * * POINTER PARAMETER\n");
  2892.             break;
  2893.        case XbWDMf_VIPar:
  2894.             printf("* * * VI-INT PARAMETER \"%d\"\n",(int)XbWVMf_P[XbWVMf_C]);
  2895.             break;
  2896.        };
  2897.      };
  2898.  
  2899.   printf("\n* * * Actual interpreter scan position: >>>\"%s\"\n\n",XbWVSy_DebugLinePos);
  2900.  
  2901.  
  2902.   XbWSGr_TLBox(1,XbWSGr_GtPhysY()-XbWDWd_BordH,500,XbWSGr_GtPhysY(),
  2903.      text,XbWVGr_LRed,XbWVGr_White,XbWVGr_Red);
  2904.   {
  2905.     XEvent event;
  2906.     event.type = 0;
  2907.     XFlush(XbWVSy_ConTxt.dpy);
  2908.     while (event.type != KeyPress){
  2909.       XNextEvent(XbWVSy_ConTxt.dpy,&event);
  2910.       };
  2911.     exit(1);
  2912.     };
  2913. #endif
  2914.   };
  2915. /*}}}  */
  2916. /*{{{  XbWSPu_Alarm(       TC3,GNU,X11    Unten am Schirm rote Box*/
  2917. void  XbWSPu_Alarm(char *msg){
  2918.   int cset;
  2919.   cset = XbWVMs_CSet;
  2920.   XbWSMs_OFF();
  2921.   XbWFTb_HBeep();
  2922.   XbWFTb_LBeep();
  2923.   XbWFGr_PushPort();
  2924.   XbWFGr_SetPort();
  2925.   XbWSGr_TLBox(1,XbWSGr_GtPhysY()-XbWDWd_BordH,500,XbWSGr_GtPhysY(),
  2926.      msg,XbWVGr_LRed,XbWVGr_White,XbWVGr_Red);
  2927. #ifdef XbW_SYSDEF_TC3_VERSION
  2928.   getch();
  2929. #endif
  2930. #ifdef XbW_SYSDEF_X11_VERSION
  2931.   XFlush(XbWVSy_ConTxt.dpy);
  2932.   {
  2933.     XEvent event;
  2934.     event.type = 0;
  2935.     while (event.type != KeyPress){
  2936.       XNextEvent(XbWVSy_ConTxt.dpy,&event);
  2937.       };
  2938.     };
  2939. #endif
  2940. #ifdef XbW_SYSDEF_GNU_VERSION
  2941.   { char a,b;
  2942.     XbWSMs_GetKey(&a,&b);
  2943.     };
  2944. #endif
  2945.   XbWSGr_TLBox(1,XbWSGr_GtPhysY()-XbWDWd_BordH,500,XbWSGr_GtPhysY(),
  2946.      NULL,XbWVGr_White,XbWVGr_White,XbWVGr_White);
  2947.   XbWFGr_PopPort();
  2948.   XbWFGr_ResPort();
  2949.   if (cset) {
  2950.     XbWSMs_ON();
  2951.     };
  2952.   };
  2953. /*}}}  */
  2954. /*{{{  XbWSPu_Msg(             ***        Nachricht in einem Window ausgeben*/
  2955. int  XbWSPu_Msg(void  *(*p)[],int (*t)[]){
  2956.  
  2957. #define DRAW_PBOX_IN_WDW 1
  2958. #define DRAW_PBOX_BORDER 2
  2959. #define DRAW_PBOX_THICK  4
  2960.  
  2961.   char fzeile[250];
  2962.   FILE *rfile;  int ll,ypos;
  2963.   char *fname; boolean ende;char *dummy="";
  2964.   int xa=0,ya=0,xb=10,yb=10,filc=0,frc=0,txc=0,dw=0;
  2965.  
  2966.   if ((int)(*p)[0] < 9) { return(1); };
  2967.  
  2968.   switch ( (int)(*t)[1]) {
  2969.     case XbWDMf_VPPar:
  2970.     case XbWDMf_IntPar: xa = (int)(*p)[1]; break;
  2971.     case XbWDMf_VLPar:  {
  2972.                           XbWDDb_DbIVar  *QQ;
  2973.                           QQ = (XbWDDb_DbIVar  *)(*p)[1];
  2974.                           xa = XbWFDb_GetNum(QQ,NULL,1);
  2975.                           break;
  2976.                           };
  2977.     };
  2978.   switch ( (int)(*t)[2]) {
  2979.     case XbWDMf_VPPar:
  2980.     case XbWDMf_IntPar: ya = (int)(*p)[2]; break;
  2981.     case XbWDMf_VLPar:  {
  2982.                           XbWDDb_DbIVar  *QQ;
  2983.                           QQ = (XbWDDb_DbIVar  *)(*p)[2];
  2984.                           ya = XbWFDb_GetNum(QQ,NULL,1);
  2985.                           break;
  2986.                           };
  2987.     };
  2988.   switch ( (int)(*t)[3]) {
  2989.     case XbWDMf_VPPar:
  2990.     case XbWDMf_IntPar: xb = (int)(*p)[3]; break;
  2991.     case XbWDMf_VLPar:  {
  2992.                           XbWDDb_DbIVar  *QQ;
  2993.                           QQ = (XbWDDb_DbIVar  *)(*p)[3];
  2994.                           xb = XbWFDb_GetNum(QQ,NULL,1);
  2995.                           break;
  2996.                           };
  2997.     };
  2998.   switch ( (int)(*t)[4]) {
  2999.     case XbWDMf_VPPar:
  3000.     case XbWDMf_IntPar: yb = (int)(*p)[4]; break;
  3001.     case XbWDMf_VLPar:  {
  3002.                           XbWDDb_DbIVar  *QQ;
  3003.                           QQ = (XbWDDb_DbIVar  *)(*p)[4];
  3004.                           yb = XbWFDb_GetNum(QQ,NULL,1);
  3005.                           break;
  3006.                           };
  3007.     };
  3008.   switch ( (int)(*t)[5]) {
  3009.     case XbWDMf_VPPar:
  3010.     case XbWDMf_IntPar: filc = (int)(*p)[5]; break;
  3011.     case XbWDMf_VLPar:  {
  3012.                           XbWDDb_DbIVar  *QQ;
  3013.                           QQ = (XbWDDb_DbIVar  *)(*p)[5];
  3014.                           filc = XbWFDb_GetNum(QQ,NULL,1);
  3015.                           break;
  3016.                           };
  3017.     };
  3018.   switch ( (int)(*t)[6]) {
  3019.     case XbWDMf_VPPar:
  3020.     case XbWDMf_IntPar: frc = (int)(*p)[6]; break;
  3021.     case XbWDMf_VLPar:  {
  3022.                           XbWDDb_DbIVar  *QQ;
  3023.                           QQ = (XbWDDb_DbIVar  *)(*p)[6];
  3024.                           frc = XbWFDb_GetNum(QQ,NULL,1);
  3025.                           break;
  3026.                           };
  3027.     };
  3028.   switch ( (int)(*t)[7]) {
  3029.     case XbWDMf_VPPar:
  3030.     case XbWDMf_IntPar: txc = (int)(*p)[7]; break;
  3031.     case XbWDMf_VLPar:  {
  3032.                           XbWDDb_DbIVar  *QQ;
  3033.                           QQ = (XbWDDb_DbIVar  *)(*p)[7];
  3034.                           txc = XbWFDb_GetNum(QQ,NULL,1);
  3035.                           break;
  3036.                           };
  3037.     };
  3038.   switch ( (int)(*t)[8]) {
  3039.     case XbWDMf_VPPar:
  3040.     case XbWDMf_IntPar: dw = (int)(*p)[8]; break;
  3041.     case XbWDMf_VLPar:  {
  3042.                           XbWDDb_DbIVar  *QQ;
  3043.                           QQ = (XbWDDb_DbIVar  *)(*p)[8];
  3044.                           dw = XbWFDb_GetNum(QQ,NULL,1);
  3045.                           break;
  3046.                           };
  3047.     };
  3048.  
  3049.  
  3050.   XbWFGr_CurOFF();
  3051.   XbWFGr_PushPort();
  3052.  
  3053.   if (dw & DRAW_PBOX_IN_WDW) {
  3054.     XbWFGr_MinPort(
  3055.       *XbWVWd_W.nx+1, 1+*XbWVWd_W.ny,   *XbWVWd_W.nx+ *XbWVWd_W.sx+1,
  3056.       *XbWVWd_W.ny+1+ *XbWVWd_W.sy);
  3057.     }
  3058.   else {
  3059.     XbWFGr_MinPort(
  3060.       0,0,XbWFGr_MaxX(),XbWFGr_MaxY());
  3061.     };
  3062.  
  3063.   if (dw & (DRAW_PBOX_THICK|DRAW_PBOX_BORDER)) {
  3064.     XbWSGr_TLBox(xa,ya,xb,yb,NULL,filc,0,frc);
  3065.     };
  3066.  
  3067.   {
  3068.     XbWDDb_DbIVar  *inf_var;
  3069.     if ((inf_var = XbWFDb_FindGrp("WDW",(char*)XbWVWd_W.nm)) == NULL){
  3070.       goto ende_popup;
  3071.       };
  3072.     if ((fname = (char*)XbWFDb_VarInh(inf_var,XbWDDb_Str,"inf",1)) == NULL){
  3073.       goto ende_popup;
  3074.       };
  3075.     };
  3076.  
  3077.   if ((rfile = XbWSSy_fopen(fname,"rt")) !=  NULL) {
  3078.     ypos = 0;
  3079.     for (ll=9;ll<=(int)(*p)[0];ll++){
  3080.       switch ((int)(*t)[ll]) {
  3081.         case XbWDMf_StrPar: rewind(rfile);
  3082.                             ende = 0;
  3083.                             do{ende = (fgets(fzeile,245,rfile) == NULL);}
  3084.                             while ((strstr(fzeile,(char *)(*p)[ll]) == NULL) &
  3085.                             (ende == 0)) ;
  3086.                             dummy=strstr(fzeile,":");
  3087.                             dummy++;
  3088.                             break;
  3089.         case XbWDMf_VPPar:
  3090.         case XbWDMf_IntPar: sprintf(fzeile,"%d",(int)(*p)[ll]);
  3091.                             dummy = fzeile;
  3092.                             break;
  3093.         case XbWDMf_VLPar:
  3094.                             {
  3095.                               XbWDDb_DbIVar  *QQ;
  3096.                               char *aov = NULL; int atp; char *ain; int ale;
  3097.                               QQ = (XbWDDb_DbIVar *)(*p)[ll];
  3098.  
  3099.                               if (XbWFDb_GetInf(QQ,0,aov,&atp,&ain,&ale,1)) {
  3100.                                 switch (atp) {
  3101.                                   case XbWDDb_Str:
  3102.                                     dummy = ain;
  3103.                                     break;
  3104.                                   case XbWDDb_Int:
  3105.                                     sprintf(fzeile,"%d",(int) *((int*)ain));
  3106.                                     dummy = fzeile;
  3107.                                     break;
  3108.                                   case XbWDDb_Dbl:
  3109.                                     sprintf(fzeile,"%7.3f",(double) *((double*)ain));
  3110.                                     dummy = fzeile;
  3111.                                     break;
  3112.                                   };
  3113.                                 };
  3114.                               };
  3115.         };
  3116.  
  3117.       if (strchr(dummy,13) != NULL) {
  3118.         strcpy(strchr(dummy,13),"\0");
  3119.         };
  3120.       if (strchr(dummy,10) != NULL) {
  3121.         strcpy(strchr(dummy,10),"\0");
  3122.         };
  3123.       XbWSGr_TLBox(xa,ya+ypos,0,0,dummy,filc,txc,0);
  3124.       ypos += 11;
  3125.       };
  3126.     fclose(rfile);
  3127.     };
  3128.  
  3129.  
  3130.   ende_popup:;
  3131.   XbWFGr_PopPort(); XbWFGr_ResPort();
  3132.   XbWFGr_CurON();
  3133.   return(0);
  3134.   };
  3135.  
  3136. /*}}}  */
  3137. /*{{{  XbWSPu_Dir(             ***        Directory-Box anzeigen*/
  3138. int  XbWSPu_Dir(void  *(*p)[],int (*t)[]){
  3139.   return XbWSPu_DirSb(p,t,0);
  3140.   };
  3141. /*}}}  */
  3142. /*{{{  XbWSPu_DirEd(           ***        Directory-Box auswerten*/
  3143. int  XbWSPu_DirEd(void  *(*p)[],int (*t)[]){
  3144.   return XbWSPu_DirSb(p,t,1);
  3145.   };
  3146. /*}}}  */
  3147. /*{{{  XbWSPu_DirCk(       TC3,GNU,x!!    Unterroutine zur DirBox*/
  3148. void  XbWSPu_DirCk(char *dummy, char *ziel_str,int ypos,int myp){
  3149.   if (ziel_str == NULL) { return; };
  3150.   if (dummy == NULL) { return; };
  3151.   #ifdef XbW_SYSDEF_X11_VERSION
  3152.   if ((ypos-5 < myp) & ( ypos+11-5 > myp)) {
  3153.     strcpy(ziel_str,dummy);
  3154.     };
  3155.   #endif
  3156.   #ifdef XbW_SYSDEF_GNU_VERSION
  3157.   if ((ypos < myp) & ( ypos+11 > myp)) {
  3158.     strcpy(ziel_str,dummy);
  3159.     };
  3160.   #endif
  3161.   #ifdef XbW_SYSDEF_X11_VERSION
  3162.   if ((ypos < myp) & ( ypos+11 > myp)) {
  3163.     strcpy(ziel_str,dummy);
  3164.     };
  3165.   #endif
  3166.   };
  3167. /*}}}  */
  3168. /*{{{  Directory-Suche  NUR X11*/
  3169.  
  3170. #ifdef XbW_SYSDEF_X11_VERSION
  3171. #include "directory.c"
  3172. /*{{{F directory.c*/
  3173. /*:::F directory.c*/
  3174. /*}}}  */
  3175.  
  3176.  
  3177. #endif
  3178.  
  3179. /*}}}  */
  3180. /*{{{  XbWSPu_DirSb(       TC3,g??,x!!    Unterroutine zur DirBox*/
  3181. int  XbWSPu_DirSb(void  *(*p)[],int (*t)[], int dmode){
  3182. #define DRAW_PBOX_IN_WDW 1
  3183. #define DRAW_PBOX_BORDER 2
  3184. #define DRAW_PBOX_THICK  4
  3185.   int ll,ypos;
  3186.   char *dummy,*spec,*fsp,*ziel_str;
  3187.   int xa,ya,xb,yb,filc,frc,txc,dw,anz=0,snr;
  3188.   int ziel_max;
  3189.   XbWDDb_DbIVar  *ziel_MV;
  3190.  
  3191.   if ((int)(*p)[0] < 14) { return(1); };
  3192.  
  3193.   /*{{{  switch ( (int)(*t)[1]) {*/
  3194.   switch ( (int)(*t)[1]) {
  3195.     case XbWDMf_VPPar:
  3196.     case XbWDMf_IntPar: xa = (int)(*p)[1]; break;
  3197.     case XbWDMf_VLPar:  {
  3198.                           XbWDDb_DbIVar  *QQ;
  3199.                           QQ = (XbWDDb_DbIVar  *)(*p)[1];
  3200.                           if (QQ == NULL) { goto pop_error; };
  3201.                           xa = XbWFDb_GetNum(QQ,NULL,1);
  3202.                           break;
  3203.                           };
  3204.     default: goto pop_error;
  3205.     };
  3206.   /*}}}  */
  3207.   /*{{{  switch ( (int)(*t)[2]) {*/
  3208.   switch ( (int)(*t)[2]) {
  3209.     case XbWDMf_VPPar:
  3210.     case XbWDMf_IntPar: ya = (int)(*p)[2]; break;
  3211.     case XbWDMf_VLPar:  {
  3212.                           XbWDDb_DbIVar  *QQ;
  3213.                           QQ = (XbWDDb_DbIVar  *)(*p)[2];
  3214.                           if (QQ == NULL) { goto pop_error; };
  3215.                           ya = XbWFDb_GetNum(QQ,NULL,1);
  3216.                           break;
  3217.                           };
  3218.     default: goto pop_error;
  3219.     };
  3220.   /*}}}  */
  3221.   /*{{{  switch ( (int)(*t)[3]) {*/
  3222.   switch ( (int)(*t)[3]) {
  3223.     case XbWDMf_VPPar:
  3224.     case XbWDMf_IntPar: xb = (int)(*p)[3]; break;
  3225.     case XbWDMf_VLPar:  {
  3226.                           XbWDDb_DbIVar  *QQ;
  3227.                           QQ = (XbWDDb_DbIVar  *)(*p)[3];
  3228.                           if (QQ == NULL) { goto pop_error; };
  3229.                           xb = XbWFDb_GetNum(QQ,NULL,1);
  3230.                           break;
  3231.                           };
  3232.     default: goto pop_error;
  3233.     };
  3234.   /*}}}  */
  3235.   /*{{{  switch ( (int)(*t)[4]) {*/
  3236.   switch ( (int)(*t)[4]) {
  3237.     case XbWDMf_VPPar:
  3238.     case XbWDMf_IntPar: yb = (int)(*p)[4]; break;
  3239.     case XbWDMf_VLPar:  {
  3240.                           XbWDDb_DbIVar  *QQ;
  3241.                           QQ = (XbWDDb_DbIVar  *)(*p)[4];
  3242.                           if (QQ == NULL) { goto pop_error; };
  3243.                           yb = XbWFDb_GetNum(QQ,NULL,1);
  3244.                           break;
  3245.                           };
  3246.     default: goto pop_error;
  3247.     };
  3248.   /*}}}  */
  3249.   /*{{{  switch ( (int)(*t)[5]) {*/
  3250.   switch ( (int)(*t)[5]) {
  3251.     case XbWDMf_VPPar:
  3252.     case XbWDMf_IntPar: filc = (int)(*p)[5]; break;
  3253.     case XbWDMf_VLPar:  {
  3254.                           XbWDDb_DbIVar  *QQ;
  3255.                           QQ = (XbWDDb_DbIVar  *)(*p)[5];
  3256.                           if (QQ == NULL) { goto pop_error; };
  3257.                           filc = XbWFDb_GetNum(QQ,NULL,1);
  3258.                           break;
  3259.                           };
  3260.     default: goto pop_error;
  3261.     };
  3262.   /*}}}  */
  3263.   /*{{{  switch ( (int)(*t)[6]) {*/
  3264.   switch ( (int)(*t)[6]) {
  3265.     case XbWDMf_VPPar:
  3266.     case XbWDMf_IntPar: frc = (int)(*p)[6]; break;
  3267.     case XbWDMf_VLPar:  {
  3268.                           XbWDDb_DbIVar  *QQ;
  3269.                           QQ = (XbWDDb_DbIVar  *)(*p)[6];
  3270.                           if (QQ == NULL) { goto pop_error; };
  3271.                           frc = XbWFDb_GetNum(QQ,NULL,1);
  3272.                           break;
  3273.                           };
  3274.     default: goto pop_error;
  3275.     };
  3276.   /*}}}  */
  3277.   /*{{{  switch ( (int)(*t)[7]) {*/
  3278.   switch ( (int)(*t)[7]) {
  3279.     case XbWDMf_VPPar:
  3280.     case XbWDMf_IntPar: txc = (int)(*p)[7]; break;
  3281.     case XbWDMf_VLPar:  {
  3282.                           XbWDDb_DbIVar  *QQ;
  3283.                           QQ = (XbWDDb_DbIVar  *)(*p)[7];
  3284.                           if (QQ == NULL) { goto pop_error; };
  3285.                           txc = XbWFDb_GetNum(QQ,NULL,1);
  3286.                           break;
  3287.                           };
  3288.     default: goto pop_error;
  3289.     };
  3290.   /*}}}  */
  3291.   /*{{{  switch ( (int)(*t)[8]) {*/
  3292.   switch ( (int)(*t)[8]) {
  3293.     case XbWDMf_VPPar:
  3294.     case XbWDMf_IntPar: dw = (int)(*p)[8]; break;
  3295.     case XbWDMf_VLPar:  {
  3296.                           XbWDDb_DbIVar  *QQ;
  3297.                           QQ = (XbWDDb_DbIVar  *)(*p)[8];
  3298.                           if (QQ == NULL) { goto pop_error; };
  3299.                           dw = XbWFDb_GetNum(QQ,NULL,1);
  3300.                           break;
  3301.                           };
  3302.     default: goto pop_error;
  3303.     };
  3304.   /*}}}  */
  3305.   /*{{{  switch ( (int)(*t)[9]) {*/
  3306.   switch ( (int)(*t)[9]) {
  3307.     case XbWDMf_VPPar:
  3308.     case XbWDMf_IntPar: anz = (int)(*p)[9]; break;
  3309.     case XbWDMf_VLPar:  {
  3310.                           XbWDDb_DbIVar  *QQ;
  3311.                           QQ = (XbWDDb_DbIVar  *)(*p)[9];
  3312.                           if (QQ == NULL) { goto pop_error; };
  3313.                           anz = XbWFDb_GetNum(QQ,NULL,1);
  3314.                           break;
  3315.                           };
  3316.     };
  3317.   /*}}}  */
  3318.   /*{{{  switch ( (int)(*t)[10]) {*/
  3319.   switch ( (int)(*t)[10]) {
  3320.     case XbWDMf_StrPar: spec = (char*)(*p)[10]; break;
  3321.     case XbWDMf_VLPar:  {
  3322.                           XbWDDb_DbIVar  *QQ;
  3323.                           QQ = (XbWDDb_DbIVar  *)(*p)[10];
  3324.                           if (QQ == NULL) { goto pop_error; };
  3325.                           spec = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1);
  3326.                           strcpy(spec,(char*)XbWFTb_PckTxt(spec));
  3327.                           break;
  3328.                           };
  3329.     default: goto pop_error;
  3330.     };
  3331.   /*}}}  */
  3332.   /*{{{  switch ( (int)(*t)[11]) {*/
  3333.   switch ( (int)(*t)[11]) {
  3334.     case XbWDMf_StrPar: fsp = (char*)(*p)[11]; break;
  3335.     case XbWDMf_VLPar:  {
  3336.                           XbWDDb_DbIVar  *QQ;
  3337.                           QQ = (XbWDDb_DbIVar  *)(*p)[11];
  3338.                           if (QQ == NULL) { goto pop_error; };
  3339.                           fsp = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1);
  3340.                           strcpy(fsp,(char*)XbWFTb_PckTxt(fsp));
  3341.                           break;
  3342.                           };
  3343.     default: goto pop_error;
  3344.     };
  3345.   /*}}}  */
  3346.   /*{{{  switch ( (int)(*t)[12]) {*/
  3347.   switch ( (int)(*t)[12]) {
  3348.     case XbWDMf_VPPar:
  3349.     case XbWDMf_IntPar: snr = (int)(*p)[12]; break;
  3350.     case XbWDMf_VLPar:  {
  3351.                           XbWDDb_DbIVar  *QQ;
  3352.                           QQ = (XbWDDb_DbIVar  *)(*p)[12];
  3353.                           if (QQ == NULL) { goto pop_error; };
  3354.                           snr = XbWFDb_GetNum(QQ,NULL,1);
  3355.                           break;
  3356.                           };
  3357.     default: goto pop_error;
  3358.     };
  3359.   /*}}}  */
  3360.   /*{{{  if (!dmode) {*/
  3361.   if (!dmode) {
  3362.     ziel_str = NULL;
  3363.     }
  3364.   else {
  3365.     switch ( (int)(*t)[13]) {
  3366.       case XbWDMf_VLPar:  {
  3367.                             XbWDDb_DbIVar  *QQ;
  3368.                             QQ = (XbWDDb_DbIVar  *)(*p)[13];
  3369.                             if (QQ == NULL) { goto pop_error; };
  3370.                             ziel_str = (char*)XbWFDb_VarInh(QQ,XbWDDb_Str,NULL,1);
  3371.                             break;
  3372.                             };
  3373.       default: goto pop_error;
  3374.       };
  3375.     };
  3376.   /*}}}  */
  3377.   /*{{{  switch ( (int)(*t)[14]) {*/
  3378.   switch ( (int)(*t)[14]) {
  3379.     case XbWDMf_VLPar:
  3380.         ziel_MV = (XbWDDb_DbIVar  *)(*p)[14];
  3381.         if (ziel_MV == NULL) { goto pop_error;};
  3382.         break;
  3383.     default: goto pop_error;
  3384.     };
  3385.   /*}}}  */
  3386.   /*{{{  XbWFGr_CurOFF();*/
  3387.   XbWFGr_CurOFF();
  3388.   XbWFGr_PushPort();
  3389.   if (dw & DRAW_PBOX_IN_WDW) {
  3390.     XbWFGr_MinPort(
  3391.       *XbWVWd_W.nx+1,1+ *XbWVWd_W.ny,   *XbWVWd_W.nx+ *XbWVWd_W.sx +1,
  3392.       *XbWVWd_W.ny+1+ *XbWVWd_W.sy);
  3393.     }
  3394.   else {
  3395.     XbWFGr_MinPort(
  3396.       0,0,XbWFGr_MaxX(),XbWFGr_MaxY());
  3397.     };
  3398.   if (dw & (DRAW_PBOX_BORDER|DRAW_PBOX_THICK)) {
  3399.     XbWSGr_TLBox(xa,ya,xb,yb,NULL,filc,0,frc);
  3400.     };
  3401.   /*}}}  */
  3402.   #ifdef XbW_SYSDEF_TC3_VERSION
  3403.     /*{{{  Eigentliche Routine*/
  3404.     {
  3405.       char fspec[60];
  3406.       struct ffblk erg;
  3407.     
  3408.       ypos = 0;
  3409.       sprintf(fspec,"%s%s",spec,fsp);
  3410.       ziel_max=0;
  3411.       if (!findfirst(fspec,&erg,0)) {
  3412.         dummy = erg.ff_name;
  3413.         if (snr == 0) {
  3414.           XbWSGr_TLBox(xa+3,ya+3+ypos,0,0,dummy,filc,txc,0);
  3415.           if (dmode) {
  3416.             XbWSPu_DirCk(dummy,ziel_str,ya+3+ypos+*XbWVWd_W.ny,XbWVMs_YPos);
  3417.             };
  3418.           ypos += 11;
  3419.           };
  3420.         ll = 1;
  3421.         ziel_max=1;
  3422.         while (!findnext(&erg))  {
  3423.           ziel_max++;
  3424.           if (ll < anz+snr-1) {
  3425.             dummy = erg.ff_name;
  3426.             if (ll >= snr) {
  3427.               XbWSGr_TLBox(xa+3,ya+2+ypos,0,0,dummy,filc,txc,0);
  3428.               if (dmode) {
  3429.                 XbWSPu_DirCk(dummy,ziel_str,ya+3+ypos+*XbWVWd_W.ny,XbWVMs_YPos);
  3430.                 };
  3431.               ypos += 11;
  3432.               };
  3433.             }
  3434.           else {
  3435.             if (ll >= snr-1) {
  3436.               XbWSGr_TLBox(xa+3,ya+2+ypos,0,0,"...",filc,txc,0);
  3437.               ypos += 11;
  3438.               };
  3439.             if (!dmode) {
  3440.               while (!findnext(&erg)) {
  3441.                 ziel_max++;
  3442.                 };
  3443.               };
  3444.             goto ende_popup;
  3445.             };
  3446.           ll++;
  3447.           };
  3448.         };
  3449.       };
  3450.     /*}}}  */
  3451.   #endif
  3452.   #ifdef XbW_SYSDEF_X11_VERSION
  3453.     /*{{{  Eigentliche Routine*/
  3454.     {
  3455.       char *erg;
  3456.       ypos = 0;
  3457.       ziel_max=0;
  3458.       if ((erg=XbWSSy_FindFirst(spec,fsp))!=NULL) {
  3459.         dummy = erg;
  3460.         if (snr == 0) {
  3461.           XbWSGr_TLBox(xa+3,ya+3+ypos,0,0,dummy,filc,txc,0);
  3462.           if (dmode) {
  3463.             XbWSPu_DirCk(dummy,ziel_str,ya+3+ypos+*XbWVWd_W.ny,XbWVMs_YPos);
  3464.             };
  3465.           ypos += 11;
  3466.           };
  3467.         ll = 1;
  3468.         ziel_max=1;
  3469.         while ((erg=XbWSSy_FindNext())!=NULL)  {
  3470.           ziel_max++;
  3471.           if (ll < anz+snr-1) {
  3472.             dummy = erg;
  3473.             if (ll >= snr) {
  3474.               XbWSGr_TLBox(xa+3,ya+2+ypos,0,0,dummy,filc,txc,0);
  3475.               if (dmode) {
  3476.                 XbWSPu_DirCk(dummy,ziel_str,ya+3+ypos+*XbWVWd_W.ny,XbWVMs_YPos);
  3477.                 };
  3478.               ypos += 11;
  3479.               };
  3480.             }
  3481.           else {
  3482.             if (ll >= snr-1) {
  3483.               XbWSGr_TLBox(xa+3,ya+2+ypos,0,0,"...",filc,txc,0);
  3484.               ypos += 11;
  3485.               };
  3486.             if (!dmode) {
  3487.               while (XbWSSy_FindNext()!=NULL) {
  3488.                 ziel_max++;
  3489.                 };
  3490.               };
  3491.             goto ende_popup;
  3492.             };
  3493.           ll++;
  3494.           };
  3495.         };
  3496.       };
  3497.     /*}}}  */
  3498.   #endif
  3499.  
  3500.  
  3501.   ende_popup:;
  3502.   if (!dmode) {
  3503.     XbWFDb_PutNum(ziel_MV,NULL,1,ziel_max);
  3504.     };
  3505.   /*{{{  XbWFGr_PopPort(); XbWFGr_ResPort();*/
  3506.   XbWFGr_PopPort(); XbWFGr_ResPort();
  3507.   XbWFGr_CurON();
  3508.   return(0);
  3509.   /*}}}  */
  3510.   /*{{{  pop_error:;*/
  3511.   pop_error:;
  3512.   XbWFGr_PopPort(); XbWFGr_ResPort();
  3513.   XbWFGr_CurON();
  3514.   /*}}}  */
  3515.   return(1);
  3516.   };
  3517.  
  3518. /*}}}  */
  3519. /*}}}  */
  3520. /*{{{  XbWSSy_XXXXMem(     TC3,GNU,X11    farcalloc bzw. calloc /-free*/
  3521. /*{{{  XbWSSy_AlocMem(     TC3,GNU,X11    farcalloc bzw. calloc*/
  3522. void  *XbWSSy_AlocMem(unsigned long a, unsigned long b){
  3523. #ifdef XbW_SYSDEF_TC3_VERSION
  3524.   return(farcalloc(a,b));
  3525. #endif
  3526. #ifdef XbW_SYSDEF_GNU_VERSION
  3527.   return(calloc(a,b));
  3528. #endif
  3529. #ifdef XbW_SYSDEF_X11_VERSION
  3530.   return(calloc(a,b));
  3531. #endif
  3532.   };
  3533. /*}}}  */
  3534. /*{{{  XbWSSy_FreeMem(     TC3,GNU,X11    farfree bzw. free*/
  3535. void  XbWSSy_FreeMem(void  *a){
  3536. #ifdef XbW_SYSDEF_TC3_VERSION
  3537.   farfree(a);
  3538. #endif
  3539. #ifdef XbW_SYSDEF_GNU_VERSION
  3540.   free(a);
  3541. #endif
  3542. #ifdef XbW_SYSDEF_X11_VERSION
  3543.   free(a);
  3544. #endif
  3545.   };
  3546. /*}}}  */
  3547. /*}}}  */
  3548. /*{{{  XbWSSy_SysXXXX(     TC3,g??,x??    System Stop*/
  3549. /*{{{  XbWSSy_SysHalt(     TC3,g??,x??    System Not-Halt*/
  3550. void   XbWSSy_SysHalt(void){
  3551. #ifdef XbW_SYSDEF_TC3_VERSION
  3552.   closegraph();
  3553.   textmode(C80);
  3554.   textcolor(WHITE);
  3555.   textbackground(BLACK);
  3556.   clrscr();
  3557. #endif
  3558.   };
  3559. /*}}}  */
  3560. /*{{{  XbWSSy_FatalEr(     TC3,g??,x??    Fataler Fehler*/
  3561. void   XbWSSy_FatalEr(char text[255]){
  3562. #ifdef XbW_SYSDEF_TC3_VERSION
  3563.   closegraph();
  3564.   textmode(C80);
  3565.   textcolor(XbWVGr_Red);
  3566.   textbackground(XbWVGr_White);
  3567.   clrscr();gotoxy(10,10);printf(text);gotoxy(10,12);exit(1);
  3568. #endif
  3569.   };
  3570. /*}}}  */
  3571. /*}}}  */
  3572. /*{{{  XbWFSy_doXXXXXXXXXX(t--,g--,X11    X11 only*/
  3573. void  XbWFSY_DoXFlush(void){
  3574.   XFlush(XbWVSy_ConTxt.dpy);
  3575.   };
  3576. /*{{{  XbWFSy_doDefineColor(       X11    Farbe allozieren (X11 only)*/
  3577. unsigned long  XbWFSy_doDefineColor(int n){
  3578. #ifdef XbW_SYSDEF_X11_VERSION
  3579.   XColor exakt_color,screen_color;
  3580.  
  3581.   if ((XDefaultVisualOfScreen(XbWVSy_ConTxt.screen))->class == TrueColor
  3582.       || (XDefaultVisualOfScreen(XbWVSy_ConTxt.screen))->class == PseudoColor
  3583.       || (XDefaultVisualOfScreen(XbWVSy_ConTxt.screen))->class == DirectColor
  3584.       ||  (XDefaultVisualOfScreen(XbWVSy_ConTxt.screen))->class == StaticColor){
  3585.     if (XAllocNamedColor( XbWVSy_ConTxt.dpy, XDefaultColormapOfScreen(XbWVSy_ConTxt.screen),
  3586.         XbWVGr_ColorTexte[n-1], &screen_color, &exakt_color)) {
  3587.       return screen_color.pixel;
  3588.       };
  3589.     }
  3590.   else {
  3591.     switch (n){
  3592.       case 1: return(XBlackPixelOfScreen(XbWVSy_ConTxt.screen));
  3593.       case 2: return(XWhitePixelOfScreen(XbWVSy_ConTxt.screen));
  3594.       case 3: return(XBlackPixelOfScreen(XbWVSy_ConTxt.screen));
  3595.       };
  3596.     };
  3597. #endif
  3598.   return(0);
  3599.   };
  3600.  
  3601. /*}}}  */
  3602. /*{{{  XbWFSy_doCreateWindow(      X11    Hauptwindow generieren*/
  3603. void  XbWFSy_doCreateWindow(void){
  3604. #ifdef XbW_SYSDEF_X11_VERSION
  3605. /*  int windowW = XWidthOfScreen(XbWVSy_ConTxt.screen)-10;  */
  3606. /*  int windowH = XHeightOfScreen(XbWVSy_ConTxt.screen)-10; */
  3607.   int windowW = XbW_X11_ScreenWidth;
  3608.   int windowH = XbW_X11_ScreenHeight;
  3609.   int windowX = 1;
  3610.   int windowY = 1;
  3611.  
  3612.   XSetWindowAttributes xswa;
  3613.  
  3614.   xswa.event_mask =   ExposureMask |
  3615.                       ButtonPressMask;
  3616.  
  3617.   xswa.background_pixel = XbWFSy_doDefineColor(8);
  3618.   xswa.backing_store    = WhenMapped;
  3619.   xswa.save_under       = 0;
  3620.   xswa.cursor           = 5;
  3621.  
  3622.   XbWVGr_ColorValues[0]  = XbWFSy_doDefineColor(1);
  3623.   XbWVGr_ColorValues[1]  = XbWFSy_doDefineColor(2);
  3624.   XbWVGr_ColorValues[2]  = XbWFSy_doDefineColor(3);
  3625.   XbWVGr_ColorValues[3]  = XbWFSy_doDefineColor(4);
  3626.   XbWVGr_ColorValues[4]  = XbWFSy_doDefineColor(5);
  3627.   XbWVGr_ColorValues[5]  = XbWFSy_doDefineColor(6);
  3628.   XbWVGr_ColorValues[6]  = XbWFSy_doDefineColor(7);
  3629.   XbWVGr_ColorValues[7]  = XbWFSy_doDefineColor(8);
  3630.   XbWVGr_ColorValues[8]  = XbWFSy_doDefineColor(9);
  3631.   XbWVGr_ColorValues[9]  = XbWFSy_doDefineColor(10);
  3632.   XbWVGr_ColorValues[10] = XbWFSy_doDefineColor(11);
  3633.   XbWVGr_ColorValues[11] = XbWFSy_doDefineColor(12);
  3634.   XbWVGr_ColorValues[12] = XbWFSy_doDefineColor(13);
  3635.   XbWVGr_ColorValues[13] = XbWFSy_doDefineColor(14);
  3636.   XbWVGr_ColorValues[14] = XbWFSy_doDefineColor(15);
  3637.   XbWVGr_ColorValues[15] = XbWFSy_doDefineColor(16);
  3638.  
  3639.   XbWVGr_ColorValues[16] = XbWFSy_doDefineColor(17);
  3640.   XbWVGr_ColorValues[17] = XbWFSy_doDefineColor(18);
  3641.   XbWVGr_ColorValues[18] = XbWFSy_doDefineColor(19);
  3642.   XbWVGr_ColorValues[19] = XbWFSy_doDefineColor(20);
  3643.   XbWVGr_ColorValues[20] = XbWFSy_doDefineColor(21);
  3644.   XbWVGr_ColorValues[21] = XbWFSy_doDefineColor(22);
  3645.   XbWVGr_ColorValues[22] = XbWFSy_doDefineColor(23);
  3646.   XbWVGr_ColorValues[23] = XbWFSy_doDefineColor(24);
  3647.   XbWVGr_ColorValues[24] = XbWFSy_doDefineColor(25);
  3648.   XbWVGr_ColorValues[25] = XbWFSy_doDefineColor(26);
  3649.   XbWVGr_ColorValues[26] = XbWFSy_doDefineColor(27);
  3650.   XbWVGr_ColorValues[27] = XbWFSy_doDefineColor(28);
  3651.   XbWVGr_ColorValues[28] = XbWFSy_doDefineColor(29);
  3652.   XbWVGr_ColorValues[29] = XbWFSy_doDefineColor(30);
  3653.   XbWVGr_ColorValues[30] = XbWFSy_doDefineColor(31);
  3654.   XbWVGr_ColorValues[31] = XbWFSy_doDefineColor(32);
  3655.  
  3656.  
  3657.   XbWVSy_ConTxt.window =
  3658.     XCreateWindow(
  3659.       XbWVSy_ConTxt.dpy,
  3660.       XRootWindowOfScreen(XbWVSy_ConTxt.screen),
  3661.       windowX,
  3662.       windowY,
  3663.       windowW,
  3664.       windowH, 0,
  3665.       XDefaultDepthOfScreen(XbWVSy_ConTxt.screen),
  3666.       InputOutput,
  3667.       XDefaultVisualOfScreen(XbWVSy_ConTxt.screen),
  3668.       CWEventMask | CWBackPixel,
  3669.       &xswa
  3670.       );
  3671. #endif
  3672.   };
  3673.  
  3674.  
  3675. /*}}}  */
  3676. /*{{{  XbWFSy_doUnmapWindows(      X11    Windowdarstellung ENDE*/
  3677. void  XbWFSy_doUnmapWindows(void){
  3678. #ifdef XbW_SYSDEF_X11_VERSION
  3679.   XUnmapWindow(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window);
  3680.   XDestroyWindow(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window);
  3681.   XCloseDisplay(XbWVSy_ConTxt.dpy);
  3682. #endif
  3683.   };
  3684.  
  3685.  
  3686. /*}}}  */
  3687. /*}}}  */
  3688. /*{{{  XbWSSy_SubWindow(*/
  3689. int  XbWSSy_SubWindow(int x, int y, int sx, int sy){
  3690.   static GC gc;
  3691.   static Window wdw;
  3692.   static GC org_gc;
  3693.   static Window org_wdw;
  3694.   static int active = 0;
  3695.  
  3696.   if (!active){
  3697.     /*{{{  */
  3698.     {
  3699.       XGCValues xgcv;
  3700.       XSetWindowAttributes xswa;
  3701.       xgcv.background = XbWFSy_doDefineColor(3);
  3702.       xgcv.background = XbWFSy_doDefineColor(3);
  3703.     
  3704.       xswa.event_mask =   ExposureMask |
  3705.                           ButtonPressMask;
  3706.     
  3707.       xswa.background_pixel = XbWFSy_doDefineColor(8);
  3708.       xswa.backing_store    = WhenMapped;
  3709.       xswa.save_under       = 0;
  3710.       xswa.cursor           = 5;
  3711.     
  3712.     
  3713.       wdw = XCreateWindow(
  3714.           XbWVSy_ConTxt.dpy,
  3715.           XRootWindowOfScreen(XbWVSy_ConTxt.screen),
  3716.           x,
  3717.           y,
  3718.           sx,
  3719.           sy, 0,
  3720.           XDefaultDepthOfScreen(XbWVSy_ConTxt.screen),
  3721.           InputOutput,
  3722.           XDefaultVisualOfScreen(XbWVSy_ConTxt.screen),
  3723.           CWEventMask | CWBackPixel,
  3724.           &xswa
  3725.           );
  3726.       gc = XCreateGC(XbWVSy_ConTxt.dpy,wdw, GCForeground | GCBackground, &xgcv);
  3727.       };
  3728.     
  3729.     XSetFont(XbWVSy_ConTxt.dpy, gc, XbWVSy_ConTxt.font);
  3730.     
  3731.     {
  3732.       XSizeHints xsh;
  3733.     
  3734.       xsh.x = x;
  3735.       xsh.y = y;
  3736.       xsh.width =  sx;
  3737.       xsh.height = sy;
  3738.       xsh.max_width =  sx;
  3739.       xsh.max_height = sy;
  3740.       xsh.flags = PMinSize | PMaxSize | PPosition | PSize;
  3741.     
  3742.       XSetWMNormalHints(XbWVSy_ConTxt.dpy, wdw, &xsh);
  3743.       XStoreName(XbWVSy_ConTxt.dpy, wdw, " Answer Request");
  3744.       XSetIconName(XbWVSy_ConTxt.dpy, wdw, "");
  3745.       };
  3746.     
  3747.     XSelectInput(
  3748.       XbWVSy_ConTxt.dpy,
  3749.       wdw,
  3750.         KeyPressMask|
  3751.         KeyReleaseMask|
  3752.         ButtonPressMask|
  3753.         ExposureMask|
  3754.         ButtonReleaseMask|
  3755.         OwnerGrabButtonMask|
  3756.         PointerMotionHintMask|
  3757.         PointerMotionMask|
  3758.         ButtonMotionMask|
  3759.         EnterWindowMask|
  3760.         LeaveWindowMask
  3761.       );
  3762.     
  3763.     org_gc = XbWVSy_ConTxt.gc;
  3764.     org_wdw = XbWVSy_ConTxt.window;
  3765.     XMapWindow(XbWVSy_ConTxt.dpy, wdw);
  3766.     XbWVSy_ConTxt.gc=gc;
  3767.     XbWVSy_ConTxt.window=wdw;
  3768.     active=1;
  3769.     /*}}}  */
  3770.     }
  3771.   else {
  3772.     XUnmapWindow(XbWVSy_ConTxt.dpy, wdw);
  3773.     XbWVSy_ConTxt.gc=org_gc;
  3774.     XbWVSy_ConTxt.window=org_wdw;
  3775.     active=0;
  3776.     };
  3777.  
  3778.   return(0);
  3779.   };
  3780.  
  3781. /*}}}  */
  3782. /*{{{  XbWSSy_ResetWM(     TC3,GNU,X11    HAUPTPROGRAMM DES XBW-SYSTEMS*/
  3783. /*int  XbWSSy_ResetWM(int argc, char *argv[]){*/
  3784. void XbWPSy_InitHooks(void);
  3785.  
  3786.  
  3787. int  XbWSSy_ResetWM(int argc, char *argv[]){
  3788.   int ii;
  3789.   char cwinp[200];
  3790.   XbWVSy_ConTxt.is_a_key_waiting = 0;
  3791.  
  3792.   puts("");
  3793.   puts("");
  3794.   XbWFSy_bf_printf("%s\n","XbW - the X11 user interface without 'bells and whistles'");
  3795.   puts("");
  3796.   puts("            (C) 1994 Hendrik Maroske");
  3797.   puts("");
  3798.   XbWFSy_bf_printf("%s\n","Use and distribution restricted to the following:");
  3799.   puts("This program is free as long as you do not make");
  3800.   puts("money by selling it. In any other case, you are");
  3801.   puts("enforced to contact the author.");
  3802.   puts("");
  3803.   puts("I don't care if you create user interfaces with");
  3804.   printf("this program and sell "); XbWFSy_bf_printf("%s","them"); puts(", als long as you");
  3805.   puts("do not sell this program. You are enforced to");
  3806.   puts("distribute this program in the same form");
  3807.   puts("you have received it; especially in combination");
  3808.   puts("with user interfaces that you sell.");
  3809.   puts("");
  3810.   puts("I will distribute C sources as soon as I can.");
  3811.   puts("Until then, you will have to rely on the library");
  3812.   puts("file only, sorry.");
  3813.   puts("");
  3814.  
  3815.   if (argc < 2) {
  3816.     puts("Usage:");
  3817.     puts("xbw Metafile.mta");
  3818.     puts("xbw Database.prj");
  3819.     puts("xbw CSource.c");
  3820.     puts("");
  3821.     exit(1);
  3822.     };
  3823.  
  3824.   XbWVIDEO_XA = 1;
  3825.   XbWVIDEO_YA = 18;
  3826.   XbWVIDEO_XB = XbWSGr_GtPhysX();
  3827.   XbWVIDEO_YB = XbWSGr_GtPhysY();
  3828.  
  3829.   XbWVDb_DbkStat = 0;
  3830.  
  3831. #ifdef XbW_SYSDEF_TC3_VERSION
  3832.   randomize();
  3833. #endif
  3834. #ifdef XbW_SYSDEF_GNU_VERSION
  3835.   if ((XbWVSy_ConTxt.top.txo_font = GrLoadFont("pc8x8.fnt")) == NULL) {return(1);};
  3836.   XbWVSy_ConTxt.top.txo_xmag = 1;
  3837.   XbWVSy_ConTxt.top.txo_ymag = 1;
  3838.   XbWVSy_ConTxt.top.txo_direct = GR_TEXT_RIGHT;
  3839.   XbWVSy_ConTxt.top.txo_xalign = GR_ALIGN_LEFT;
  3840.   XbWVSy_ConTxt.top.txo_yalign = GR_ALIGN_TOP;
  3841.   XbWVSy_ConTxt.top.txo_chrtype = GR_BYTE_TEXT;
  3842. #endif
  3843. #ifdef XbW_SYSDEF_X11_VERSION
  3844.   XbWVIDEO_XA = 0;
  3845.   XbWVIDEO_YA = 0;
  3846.   XbWVIDEO_XB = XbW_X11_ScreenWidth;
  3847.   XbWVIDEO_YB = XbW_X11_ScreenHeight;
  3848.  
  3849.   XbWVSy_ConTxt.dpy = XOpenDisplay(0);
  3850.   if (!XbWVSy_ConTxt.dpy){
  3851.     printf("ERROR: Could not open X11 Display!");
  3852.     exit(-1);
  3853.     };
  3854.   XbWVSy_ConTxt.screen = XDefaultScreenOfDisplay(XbWVSy_ConTxt.dpy);
  3855.  
  3856.   /* XSynchronize(XbWVSy_ConTxt.dpy,1); */
  3857.  
  3858.   XbWFSy_doCreateWindow();
  3859.   {
  3860.     XGCValues xgcv;
  3861.     xgcv.foreground = XbWFSy_doDefineColor(3);
  3862.     xgcv.background = XbWFSy_doDefineColor(3);
  3863.  
  3864.     XbWVSy_ConTxt.gc = XCreateGC(XbWVSy_ConTxt.dpy,
  3865.           XbWVSy_ConTxt.window, GCForeground | GCBackground, &xgcv);
  3866.     };
  3867.  
  3868.   {
  3869.     XbWVSy_ConTxt.font = XLoadFont(XbWVSy_ConTxt.dpy,
  3870.       "-schumacher-*-bold-r-normal-*-10-*-*-*-c-*-iso8859-1"
  3871.       );
  3872.     XSetFont(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.gc, XbWVSy_ConTxt.font);
  3873.     };
  3874.  
  3875.   {
  3876.     XSizeHints xsh;
  3877.  
  3878.     xsh.x = 30;
  3879.     xsh.y = 30;
  3880.     xsh.width =  XbW_X11_ScreenWidth;
  3881.     xsh.height = XbW_X11_ScreenHeight;
  3882.     xsh.max_width =  XWidthOfScreen(XbWVSy_ConTxt.screen)-31;
  3883.     xsh.max_height = XHeightOfScreen(XbWVSy_ConTxt.screen)-31;
  3884.     xsh.flags = PMinSize | PMaxSize |/* PPosition |*/ PSize;
  3885.  
  3886.     XSetWMNormalHints(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window, &xsh);
  3887.     XStoreName(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window, XbWDSy_WindowName);
  3888.     XSetIconName(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window, "XbW");
  3889.     };
  3890.  
  3891.   XSelectInput(
  3892.     XbWVSy_ConTxt.dpy,
  3893.     XbWVSy_ConTxt.window,
  3894.       KeyPressMask|
  3895.       KeyReleaseMask|
  3896.       ButtonPressMask|
  3897.       ExposureMask|
  3898.       ButtonReleaseMask|
  3899.       OwnerGrabButtonMask|
  3900.       PointerMotionHintMask|
  3901.       PointerMotionMask|
  3902.       ButtonMotionMask|
  3903.       EnterWindowMask|
  3904.       LeaveWindowMask
  3905.     );
  3906.  
  3907.   XMapWindow(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window);
  3908.  
  3909. #endif
  3910.   XbWFGr_MaxPort(); XbWFGr_PushPort();
  3911.   XbWSMs_DrInit();
  3912.   XbWFGr_MinPort(XbWVIDEO_XA,XbWVIDEO_YA,XbWFGr_MaxX(),XbWFGr_MaxY());
  3913.   XbWFWd_BackGr();
  3914.   XbWFMf_initMta();
  3915.   XbWPSy_InitHooks();
  3916.   strcpy(XbWVSy_SysPath,"\\XW\\");
  3917.   strcpy(XbWVSy_AppPath,"\\XW\\");
  3918.   strcpy(XbWVSy_PrjPath,"\\XW\\");
  3919.   ii = 1;
  3920.   while (ii < argc) {
  3921.     strcpy(cwinp,(char*)argv[ii]);
  3922.     strupr(cwinp);
  3923.     if (strstr(cwinp,".PRJ") != NULL) {
  3924.       XbWFMf_ReadMF("specials/xbwfaststart");
  3925.       XbWFTb_Message((char*)argv[ii]);
  3926.       {
  3927.         void  *ap[2] = {(void *)1,(void*)argv[ii]};
  3928.         int at[2] = { XbWDMf_IntPar,
  3929.                       XbWDMf_StrPar };
  3930.         XbWFDb_OpenSys(&ap,&at);
  3931.         goto done;
  3932.         };
  3933.       };
  3934.     if (strstr(cwinp,".MTA") != NULL) {
  3935.       XbWFTb_Message((char*)argv[ii]);
  3936.       XbWFMf_ReadMF((char*)argv[ii]);
  3937.       goto done;
  3938.       };
  3939.     if (strstr(cwinp,".XWX") != NULL) {
  3940.       XbWFTb_Message((char*)argv[ii]);
  3941.       XbWFMf_ReadMF((char*)argv[ii]);
  3942.       goto done;
  3943.       };
  3944.     if (strstr(cwinp,".C") != NULL) {
  3945.       XbWFTb_Message((char*)argv[ii]);
  3946.       XbWFMf_ReadMF((char*)argv[ii]);
  3947.       printf("Compiling your program %s\n",(char*)argv[ii]);
  3948.       XbWFTb_Message("Starting compiler; please wait...");
  3949.       {
  3950.         char sstr[500];
  3951.         char progname[200];
  3952.         sprintf(progname,(char*)argv[ii]);
  3953.         strcpy(strstr(progname,".c"),"\0");
  3954.         sprintf(sstr,"cc -o %s %s",progname,(char*)argv[ii]);
  3955.         printf("Executing %s\n",sstr);
  3956.         system(sstr);
  3957.         printf("\nOK, done with compiling. Resuming your Application.\n");
  3958.         strcat(progname,".xwx");
  3959.         printf("\nRem.: if you create a symbolic link to %s and start xbw\n",
  3960.           progname);
  3961.         printf("with 'xbw %s', I will not fire up the compiler every time.\n",
  3962.           progname);
  3963.         };
  3964.       goto done;
  3965.       };
  3966.  
  3967.     XbWFMf_ReadMF((char*)argv[ii]);
  3968.     done:;
  3969.     ii++;
  3970.     };
  3971.   if (XbWVWd_Activ){
  3972.     XbWFWd_WManager();
  3973.     };
  3974.   XbWSMs_Stop();
  3975. #ifdef XbW_SYSDEF_X11Version
  3976.   XbWFSy_doUnmapWindows();
  3977. #endif
  3978.   XbWFSy_SysStop();
  3979.   XbWSGr_Close();
  3980.   return(0);
  3981.   };
  3982.  
  3983. /*}}}  */
  3984. /*{{{  XbWSSy_RootWindow           X11    Groesse des Rootwindows aendern*/
  3985. int XbWSSy_RootWindow(void  *(*p)[],int (*t)[]){
  3986.   int xsize,ysize;
  3987.   int windowW;
  3988.   int windowH;
  3989.   XSizeHints xsh;
  3990.   if ((int)(*p)[0] < 2 ) {return(1);};
  3991.   switch( (int)(*t)[1] ) {
  3992.     case XbWDMf_IntPar:
  3993.       xsize = (int)(*p)[1];
  3994.       break;
  3995.     case XbWDMf_VLPar:
  3996.       {
  3997.         XbWDDb_DbIVar  *QQ;
  3998.         QQ = (XbWDDb_DbIVar  *)(*p)[1];
  3999.         if (QQ == NULL) { return(1); };
  4000.         xsize = XbWFDb_GetNum(QQ,NULL,1);
  4001.         };
  4002.       break;
  4003.     };
  4004.   switch( (int)(*t)[2] ) {
  4005.     case XbWDMf_IntPar:
  4006.       ysize = (int)(*p)[2];
  4007.       break;
  4008.     case XbWDMf_VLPar:
  4009.       {
  4010.         XbWDDb_DbIVar  *QQ;
  4011.         QQ = (XbWDDb_DbIVar  *)(*p)[2];
  4012.         if (QQ == NULL) { return(1); };
  4013.         ysize = XbWFDb_GetNum(QQ,NULL,1);
  4014.         };
  4015.       break;
  4016.     };
  4017.  
  4018.  
  4019.   windowW = xsize*XbWFGr_TWidth("M");
  4020.   windowH = ysize*XbWFGr_THeight();
  4021.   XbW_X11_ScreenWidth=windowW;
  4022.   XbW_X11_ScreenHeight=windowH;
  4023.   XbWVIDEO_XB = XbW_X11_ScreenWidth;
  4024.   XbWVIDEO_YB = XbW_X11_ScreenHeight;
  4025.  
  4026.   xsh.width =  windowW;
  4027.   xsh.height = windowH;
  4028.   xsh.flags = PSize;
  4029.   XSetWMNormalHints(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window, &xsh);
  4030.   XbWSMs_SetClockCursor();
  4031.   XResizeWindow(
  4032.           XbWVSy_ConTxt.dpy,
  4033.           XbWVSy_ConTxt.window,
  4034.           windowW,
  4035.           windowH);
  4036.   XbWSMs_SetArrowCursor();
  4037.   XMapWindow(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.window);
  4038.   sleep(1);
  4039.   XbWFWd_DrawAll();
  4040.   return(0);
  4041.   };
  4042. /*}}}  */
  4043. /*{{{  XbWSSy_LoadFont(char *fontname){*/
  4044. int XbWSSy_LoadFont(char *fontname){
  4045.     XUnloadFont(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.font);
  4046.     XbWVSy_ConTxt.font = XLoadFont(XbWVSy_ConTxt.dpy,fontname);
  4047.     XSetFont(XbWVSy_ConTxt.dpy, XbWVSy_ConTxt.gc, XbWVSy_ConTxt.font);
  4048.     return(1);
  4049.     };
  4050. /*}}}  */
  4051.  
  4052.  
  4053.